Closed Bug 1667787 Opened 4 years ago Closed 4 years ago

Save image as... stores `image/webp` as `jpeg` file, breaking opening in other applications

Categories

(Firefox :: File Handling, defect, P3)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
84 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox81 --- wontfix
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- verified
firefox85 --- verified

People

(Reporter: vlucaci, Assigned: Gijs)

References

Details

(Keywords: regressionwindow-wanted)

Attachments

(2 files)

Affected versions

  • 82.0b4(20200926073307)
  • 83.0a1(20200928094830)

Affected platforms

  • macOS 10.15

Steps to reproduce

  1. Launch FF.
  2. Go to https://www.reddit.com/r/pics/ .
  3. Right click on any image to bring out context menu.
  4. Click Save image as...
  5. Open the stored image.

Expected result

  • The image should be opened without any issues.

Actual result

  • Error is displayed stating the the image file cannot be opened.

Suggested Severity

  • Seeing as how this only occurs for macOS platform, and the image can still be saved via other ways, I would consider this issue an S3

Regression range

  • Will return with regression ASAP.

Additional notes

  • This issue does not occur for Windows and Ubuntu platforms.
Severity: -- → S3
Flags: needinfo?(gijskruitbosch+bugs)
Priority: -- → P3
Summary: [macOS] Save image as... stores corrupt file instead → [macOS] Save image as... stores `image/webp` as `jpeg` file, breaking opening in other applications
QA Whiteboard: [qa-regression-triage]
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Flags: needinfo?(gijskruitbosch+bugs)

This changes two bits of Firefox that, together with the mime service, end up
very confused over webp + jpeg.

  1. it changes contentAreaUtils.js' getDefaultExtension that if it gets an image
    mimetype as the content type, it should ignore the URL. It doesn't have full channel
    info so it can't really do better anyway. This fixes the context menu's "save image as..."
    case.
  2. it changes the external helper app service to do a few things slightly differently:
    a. If we're told not to get an extension out of a URL, really don't. Don't just get the
    filename and then get it from there anyway...
    b. If we've got a suggested filename, and a primary extension for the mimetype,
    and the extension on the file is not one of the known extensions for the mimetype,
    replace it with the primary extension.
    This fixes the link case.

It also adds tests for both of these mechanisms as well as "save image as."

So this patch works on macOS, but I'm not sure what else it breaks and I want to test it manually on Windows, too, before requesting review.

Trypush:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=642be104dc38028a23b05a9e8629dfa18c33ed3e

Flags: needinfo?(gijskruitbosch+bugs)
Has Regression Range: --- → no
Has STR: --- → yes
Flags: needinfo?(gijskruitbosch+bugs)
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/fc8c5c66f081
fix saving webp images served with jpeg extensions without content-disposition information, r=mak
Flags: needinfo?(gijskruitbosch+bugs)
See Also: → 1671930
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/19f174844357
fix saving webp images served with jpeg extensions without content-disposition information, r=mak
Flags: needinfo?(gijskruitbosch+bugs)
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ff2ad4b3e863
fix saving webp images served with jpeg extensions without content-disposition information, r=mak

Backed out for failures on test_nullCharFile.xhtml

backout: https://hg.mozilla.org/integration/autoland/rev/421ef74443011799bfb10c7f58138ad3709e34e5

push: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&revision=ff2ad4b3e863195075076107dc008bf248da9a91&test_paths=uriloader%2Fexthandler%2Ftests%2Fmochitest%2Fmochitest.ini&selectedTaskRun=bvCJgzncTPSWYQtTH7H9RQ.0

failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=319149100&repo=autoland&lineNumber=4921

[task 2020-10-20T16:16:29.910Z] 16:16:29 INFO - TEST-START | uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml
[task 2020-10-20T16:16:30.212Z] 16:16:30 INFO - GECKO(2915) | [Parent 2915, Main Thread] WARNING: '!aLoadingPrincipal || !aLoadingPrincipal->IsSystemPrincipal()', file /builds/worker/checkouts/gecko/dom/file/uri/BlobURLProtocolHandler.cpp:758
[task 2020-10-20T16:16:30.216Z] 16:16:30 INFO - TEST-INFO | started process screentopng
[task 2020-10-20T16:16:30.560Z] 16:16:30 INFO - TEST-INFO | screentopng: exit 0
[task 2020-10-20T16:16:30.560Z] 16:16:30 INFO - Buffered messages logged at 16:16:30
[task 2020-10-20T16:16:30.560Z] 16:16:30 INFO - add_task | Entering test
[task 2020-10-20T16:16:30.560Z] 16:16:30 INFO - Buffered messages finished
[task 2020-10-20T16:16:30.563Z] 16:16:30 INFO - TEST-UNEXPECTED-FAIL | uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml | got the expected sanitized name - got "test.html_.asc", expected "test.html_.png"
[task 2020-10-20T16:16:30.563Z] 16:16:30 INFO - SimpleTest.is@SimpleTest/SimpleTest.js:500:14
[task 2020-10-20T16:16:30.563Z] 16:16:30 INFO - @uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml:32:7
[task 2020-10-20T16:16:30.563Z] 16:16:30 INFO - GECKO(2915) | [Parent 2915, Main Thread] WARNING: '!aLoadingPrincipal || !aLoadingPrincipal->IsSystemPrincipal()', file /builds/worker/checkouts/gecko/dom/file/uri/BlobURLProtocolHandler.cpp:758
[task 2020-10-20T16:16:30.564Z] 16:16:30 INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-10-20T16:16:30.564Z] 16:16:30 INFO - TEST-UNEXPECTED-FAIL | uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml | got the expected sanitized name - got "test.html.asc", expected "test.html._png"
[task 2020-10-20T16:16:30.564Z] 16:16:30 INFO - SimpleTest.is@SimpleTest/SimpleTest.js:500:14
[task 2020-10-20T16:16:30.564Z] 16:16:30 INFO - @uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml:32:7
[task 2020-10-20T16:16:30.565Z] 16:16:30 INFO - add_task | Leaving test
[task 2020-10-20T16:16:30.566Z] 16:16:30 INFO - GECKO(2915) | MEMORY STAT | vsize 2550MB | residentFast 144MB | heapAllocated 10MB
[task 2020-10-20T16:16:30.687Z] 16:16:30 INFO - TEST-OK | uriloader/exthandler/tests/mochitest/test_nullCharFile.xhtml | took 782ms

Flags: needinfo?(gijskruitbosch+bugs)

Hrmpf, try was green so I landed this an hour after bug 1637745 which landed the test that broke? Talk about bad luck.

Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a3815d601038
fix saving webp images served with jpeg extensions without content-disposition information, r=mak
Flags: needinfo?(gijskruitbosch+bugs)
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
See Also: → 1652520

The patch landed in nightly and beta is affected.
:Gijs, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(gijskruitbosch+bugs)
Attached image img format break.gif

It seems that this is happening on Windows 7 as well and probably Windows 10 too, as I just stumbled upon this issue while testing on 83.0b4.

OS: macOS → All
Summary: [macOS] Save image as... stores `image/webp` as `jpeg` file, breaking opening in other applications → Save image as... stores `image/webp` as `jpeg` file, breaking opening in other applications

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

... and I want to test it manually on Windows, too, before requesting review.

Windows 7: works for me

Regressions: 1676240
Regressions: 1676345
Flags: qe-verify+

Hello,

Confirming this issue as verified fixed on 84.0(20201210144358) and 85.0a1(20201211093444) using Win10, macOS 10.15 .

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Regressions: 1683581
Regressions: 1684183
Regressions: 1684202
Regressions: 1685102
Regressions: 1685250
Regressions: 1688306
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: