Reputation: 208
I have been uploading .jpg files to GCS for a while and I have not changed my code which does this operation in the last 5 months. About a month ago, I started to realize that some of my uploaded image files started to get listed as Type:Folder instead of Type:image/jpeg as they used to be.
The UI of the GCS has changed around a month ago and I have a feeling something in the background had also changed and it is either a Google bug (unlikely) or I have always been uploading the pictures the wrong way (Potentially with some wrong metadata or something that prevents GCS to recognize them as image/jpeg) and it just caught up to me with Google updating something.
Before I start digging deeper into my speculation of metadata, I wanted to ask here if anybody else has encountered the same problem. If yes, what was the fix?
Summary: no code change, around a month ago, GCS web UI started to list my "image/jpeg" as "Folder". Is anybody aware of a change from Google side that could make this happen?
Upvotes: 1
Views: 476
Reputation: 208
I solved the issue. I had this code right before sending the file to the server;
String contentType = URLConnection.guessContentTypeFromStream(stream);
this fails to recognize that it's image/jpeg because the picture's metadata is destroyed during all the image processing I do earlier.
Now, I hardcoded it and it works as follows
String contentType = "image/jpeg";
Solution: specify the contentType of the file before sending it to the server.
Upvotes: 1