Closed Bug 1598216 Opened 5 years ago Closed 4 years ago

Saving images in Firefox sometimes produces ".jpg-large" files which are difficult to work with

Categories

(Firefox :: File Handling, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Firefox 76
Tracking Status
firefox76 --- fixed

People

(Reporter: djvj, Assigned: mak)

References

(Blocks 1 open bug, Regressed 1 open bug)

Details

Attachments

(1 file)

This is a copy-paste of a reddit comment I read on a thread about Firefox.

The only issue I have with Firefox is every time I try to save a picture it saves it as a JPG Large for whatever reason and those don't send well over Messengers or Discord. It's annoying enough that I use lightshot to screencap pictures instead of trying to save them.

This seems to be an issue with saving image files from websites (e.g. twitter) that use the URL convention "https://.../foo.jpg:large" (or :orig, etc.) to indicate variant encodings of the same source image.

Follow-up comment on the same thread:

Well I used chrome for years and never had an issue we're trying to save the picture. You know, right click save etc. It just worked. And to the best of my knowledge from what I remember playing around on edge it does the same. For whatever reason it's just Firefox that seems to have that issue for me. I don't know what causes it, and I hate that normal jpg isn't an option whenever I click to save a picture for whatever reason. It's not a deal-breaker because I still use Firefox as my main browser now, it's just super annoying having to use a program on the side for something that I've never had an issue with before.

I can't reproduce, unfortunately. More detailed steps would really help - even a twitter link where this happens? I tried to find the reddit page based on the quotes but was unsuccessful.

Flags: needinfo?(kvijayan)

Hm, looks like some google chrome (...) support link has https://pbs.twimg.com/media/BME07E4CAAA4jqU.jpg:large with the same issue reported.

When saving that link using right click + save link as, I can reproduce, but if I actually open the link and then use cmd+s, macOS suffixes '.jpg' based on the filetype. Still not entirely sure why it's not working...

Flags: needinfo?(kvijayan) → needinfo?(gijskruitbosch+bugs)

So the issue is that https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/uriloader/exthandler/nsExternalHelperAppService.cpp#685-728 gets a suggested file name out of the URL which includes jpg:large. We then get the primary extension in https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/uriloader/exthandler/nsExternalHelperAppService.cpp#783-787 as the suggested extension, but do not replace the extension for the filename . Some options:

  1. replace the extension if it contains illegal characters
  2. replace the extension if a mime info for the content type does not include the extension in question (on Windows we can also check in the registry if we know the extension). We should be cautious about always overwriting .jpeg with .jpg for instance.
  3. replace the extension if it mismatches iff the extension/filename didn't come from a content-disposition header (ie was parsed out of the URL).

Marco said he was interested in looking at this. :-)

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(mak)
Priority: -- → P3
Assignee: nobody → mak
Status: NEW → ASSIGNED
Flags: needinfo?(mak)
Pushed by mak77@bonardo.net:
https://hg.mozilla.org/integration/autoland/rev/45f786f133e9
Change file extensions with invalid characters to valid file extensions on save. r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 76
Regressions: 1637973
Regressions: 1642442
Regressions: 1651800
Regressions: 1813366
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: