0

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:

  1. Why does my browser not always store images with an extension?
  2. 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.)
4
  • @Tetsujin yea I definitely already have file extensions showing. Commented Aug 8, 2022 at 22:22
  • otherwise i wouldn't have been able to tell that extensions show for some files but not others Commented Aug 8, 2022 at 22:35
  • “It’s not a global setting” where would extensions not show if I have their display enabled? Commented Aug 9, 2022 at 14:49
  • "Had you just looked at the place I asked" I did right away. And when I wrote "yea I definitely already have file extensions showing" that was the confirmation that I did. My subsequent comments and question weren't personal. Curious that you deleted your first comment... Commented Aug 10, 2022 at 16:05

1 Answer 1

2

The HTTP headers show no extension for the duckduckgo link:

Content-Type: image/jpeg
...
Content-Disposition: inline; filename="Golden-Gate-Bridge-Xlg-1233898474"; filename*=UTF-8''Golden-Gate-Bridge-Xlg-1233898474

So this may be a case of garbage in, garbage out.

Manually putting a .png extension onto the Golden-Gate-Bridge-Xlg-1233898474 file that is actually of type image/jpeg will complicate things even more.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .