Closed Bug 1583921 Opened 5 years ago Closed 5 years ago

Firefox is downloading all images as webp again

Categories

(Core :: Networking: HTTP, defect)

All
Windows
defect
Not set
normal

Tracking

()

RESOLVED INVALID
Tracking Status
firefox69 --- affected
firefox70 --- affected
firefox71 --- affected

People

(Reporter: moltres.facesits.justin.coolidge, Unassigned, NeedInfo)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

I am trying to download some jpg files that I need for class. I am giving a presentation on Argentina and ALL the images that I am trying to download are downloading in .webp format which PowerPoint CANNOT use!

you guys said that the issue was fixed (according to the bug report that I filed more than six months ago), but it is STILL happening! I looked in about:config and found that the line I was supposed to delete is still gone so that is NOT the issue!

I opened up https://trip101.com/article/traditional-food-in-argentina

Right clicked some of the food images to save them

Actual results:

Despite the fact that these are jpg files, Firefox is trying to save them as .webp files

Expected results:

Firefox should download these images as the image format that they are originally.

Hi,

I have managed to reproduce this issue on latest FF release (69.0.1), latest Beta 70.0b11 and latest Nightly build 71.0a1 (2019-10-03) using Windows 10 and Windows 7.
I will move this over to a component so developers can take a look over it. From comment 1 it seems this issue is related to bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1530887

Thanks.

Status: UNCONFIRMED → NEW
Component: Untriaged → Networking: HTTP
Ever confirmed: true
OS: Unspecified → Windows
Product: Firefox → Core
Hardware: Unspecified → All
See Also: → 1530887
Version: 69 Branch → Trunk

Baku were you looking into the referenced bug, and if so could you weigh in on this one?

Flags: needinfo?(amarchesini)

Anne, what do you think it should be the right Accept header for images?

So far firefox uses: image/webp,/
Chrome uses: image/webp,image/apng,image/,/*;q=0.8

I haven't checked safari.

Flags: needinfo?(amarchesini) → needinfo?(annevk)

Andrea, I don't think this is related to the Accept header (if you think we should change things there, let's do that in a separate bug). Given that OP is using Windows, I suspect this is basically bug 1571247, but OP somehow got WEBP in their registry instead of JFIF.

Flags: needinfo?(annevk)

Dupe of / related to bug 1526731?

Gijs, as far as I can tell the server here is not sending WEBP, as also mentioned in OP. (Downloading an image on macOS results in a JPG.) That's why that other bug seems more plausible to me.

(In reply to :Gijs (he/him) from comment #12)

presumably imglib doesn't care about the content type and uses magic numbers instead or something, which is (presumably) why we display them despite the wrong content-type.

This behavior is defined in the mimesniff spec. We should determine the file extension based on the computed MIME type (image/png in this case) instead of the supplied one when we save an image.

(In reply to Masatoshi Kimura [:emk] from comment #13)

(In reply to :Gijs (he/him) from comment #12)

presumably imglib doesn't care about the content type and uses magic numbers instead or something, which is (presumably) why we display them despite the wrong content-type.

This behavior is defined in the mimesniff spec. We should determine the file extension based on the computed MIME type (image/png in this case) instead of the supplied one when we save an image.

Is this computed mimetype currently exposed to (chrome) JS anywhere?

Flags: needinfo?(VYV03354)

I don't know.

Flags: needinfo?(VYV03354)

Valentin, you can probably answer comment 14 or know who can?

Flags: needinfo?(valentin.gosu)

(In reply to :Gijs (he/him) from comment #14)

(In reply to Masatoshi Kimura [:emk] from comment #13)

(In reply to :Gijs (he/him) from comment #12)

presumably imglib doesn't care about the content type and uses magic numbers instead or something, which is (presumably) why we display them despite the wrong content-type.

This behavior is defined in the mimesniff spec. We should determine the file extension based on the computed MIME type (image/png in this case) instead of the supplied one when we save an image.

Is this computed mimetype currently exposed to (chrome) JS anywhere?

I think you can get the sniffed mimeType from nsIChannel.contentType - we call the TypeSniffers when the LOAD_CALL_CONTENT_SNIFFERS flag is set, which then sets the sniffed mime type as the contentType of the channel.
I hope this helps.

Flags: needinfo?(valentin.gosu) → needinfo?(gijskruitbosch+bugs)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #17)

(In reply to :Gijs (he/him) from comment #14)

(In reply to Masatoshi Kimura [:emk] from comment #13)

(In reply to :Gijs (he/him) from comment #12)

presumably imglib doesn't care about the content type and uses magic numbers instead or something, which is (presumably) why we display them despite the wrong content-type.

This behavior is defined in the mimesniff spec. We should determine the file extension based on the computed MIME type (image/png in this case) instead of the supplied one when we save an image.

Is this computed mimetype currently exposed to (chrome) JS anywhere?

I think you can get the sniffed mimeType from nsIChannel.contentType - we call the TypeSniffers when the LOAD_CALL_CONTENT_SNIFFERS flag is set, which then sets the sniffed mime type as the contentType of the channel.
I hope this helps.

For all the images I've checked the result for this is image/webp.

But also, all those images when downloaded (by right clicking the image + "save image as", or right clicking the image and then "view image" and then "save file", actually produce a file that file identifies as a webp image, rather than a png or jpeg.

Can someone provide clear steps where they can show we're showing a jpeg or png image that we mistakenly download as a jpeg? (yes, I said in comment #12 that the server returns png - I now think I was wrong and despite the URL displayed (and the finalURI on the channel) indicating "png", we do actually get webp content -- I'll mark the comment obsolete).

Flags: needinfo?(moltres.facesits.justin.coolidge)
Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(annevk)

On macOS, Firefox Nightly:

  1. Visit https://trip101.com/article/traditional-food-in-argentina.
  2. Save the image under "1. Locro – traditional Argentinian stew".
  3. End up with a .JPG.

(Inspecting headers doesn't tell a different story.)

Flags: needinfo?(annevk)

(In reply to Anne (:annevk) from comment #19)

On macOS, Firefox Nightly:

  1. Visit https://trip101.com/article/traditional-food-in-argentina.
  2. Save the image under "1. Locro – traditional Argentinian stew".
  3. End up with a .JPG.

(Inspecting headers doesn't tell a different story.)

Following these steps on a clean profile on today's nightly (using the context menu and "save image as") saves a webp for me, also on macOS...

Per discussion with Anne, it seems the use of jpg may depend on cookies. On a clean profile, the server sends us webp and we offer to save as webp. This is also what other webp-capable browsers do. If you need the images to be compatible with other programs you could use an extension to convert images when saving them.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.