When I download an image using Chrome or Chrome Canary, the saved file sometimes (not always) lacks an extension.
For example, I can reproduce it with this image: https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.urbansplatter.com%2Fwp-content%2Fuploads%2F2014%2F05%2FGolden-Gate-Bridge-Xlg.jpg&f=1&nofb=1
But not with this one: https://www.urbansplatter.com/wp-content/uploads/2014/05/Golden-Gate-Bridge-Xlg.jpg (this is the same image but not behind DuckDuckGo's proxy).
I seem to always be able to reproduce it when saving images from DuckDuckGo.
At first I thought maybe the content-type response header isn't set in the DuckDuckGo response and that leaves Chrome wondering what the file extension might be. But that isn't true: both links have the same content-type (image/jpeg).
To make things even weirder: when I manually add a file extension of .png
to the file, crop the image using Preview, and hit save, something is appended to the filename (e.g. 'Golden-Gate-Bridge-Xlg-1233898474.png' becomes 'Golden-Gate-Bridge-Xlg-1233898474.png.sb-701061cc-ssTk8o') and the cropped area is stored in a separate file (under 'Golden-Gate-Bridge-Xlg-1233898474.jpeg'). This does not happen when I use .jpeg as extension to begin with.
So my questions are:
- Why does my browser not always store images with an extension?
- Why that weird behavior when cropping images? My current guess is: the file in question is 'really' a jpeg and the weird behavior is my OS coercing it back into a jpeg because I gave it a png extension. (But if it knows it's 'really' a jpeg, that brings us back to question 1.)