Save Image of JPEG files appends extra ".jpeg" filename extension (e.g. "example.jpg.jpeg")

VERIFIED FIXED in Firefox 20

Status

()

Firefox for Android
General
P4
normal
VERIFIED FIXED
5 years ago
9 months ago

People

(Reporter: cpeterson, Assigned: Ian Patterson)

Tracking

unspecified
Firefox 20
ARM
Android
Points:
---

Firefox Tracking Flags

(firefox11 affected, firefox12 affected, firefox13 affected, firefox14 affected, firefox15 affected, firefox16 affected, firefox17 affected, firefox18 affected, firefox19 wontfix, firefox20 verified, fennec+)

Details

(Whiteboard: [mentor=cpeterson][lang=java][lang=js])

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

5 years ago
STR:
1. Load http://www.jpeg.org (or any website with an embedded .jpg image).
2. Long-press on the big blue image.
3. From the popup menu, select "Save Image".

AR:
The downloaded file's name adds a redundant ".jpeg" filename extension, such as "example.jpg.jpeg".

ER:
The downloaded file should be named "example.jpg".

NOTE:
Downloading .gif and .png files works as expected. The downloaded files do not have redundant filename extensions.
Priority: -- → P4

Updated

5 years ago
status-firefox11: --- → affected
status-firefox12: --- → affected
status-firefox13: --- → affected
Issue is still reproducible on Firefox Native 14.0 beta 1 on HTC Desire running Android 2.2

Updated

5 years ago
Whiteboard: [14.0b1]

Updated

5 years ago
tracking-fennec: --- → ?
status-firefox14: --- → affected
status-firefox15: --- → affected
status-firefox16: --- → affected
status-firefox17: --- → affected
Assignee: nobody → cpeterson
tracking-fennec: ? → +

Updated

5 years ago
status-firefox18: --- → affected
(Reporter)

Updated

5 years ago
Assignee: cpeterson → nobody
Whiteboard: [14.0b1] → [mentor=cpeterson][lang=java][lang=javascript]

Updated

5 years ago
Whiteboard: [mentor=cpeterson][lang=java][lang=javascript] → [mentor=cpeterson][lang=java][lang=js]
(Assignee)

Comment 2

5 years ago
Created attachment 688301 [details] [diff] [review]
Belongs in 'objdir-droid/dist/bin/chrome/toolkit/content/global/'

Added a return statement to line 1009 in an existing try/catch statement (checks if the save target has an extension instead of assigning a new one).
Hi Ian,

You will need to submit an attachment as a patch (https://developer.mozilla.org/en/docs/Creating_a_patch)
(Reporter)

Updated

5 years ago
Assignee: nobody → ipatterson
Status: NEW → ASSIGNED
(Assignee)

Comment 4

5 years ago
Created attachment 688457 [details] [diff] [review]
Included a return statement for a urlext try/catch

Re-uploading changes in patch form.
Attachment #688301 - Attachment is obsolete: true

Updated

5 years ago
Attachment #688457 - Flags: review?(gavin.sharp)
(Reporter)

Comment 5

5 years ago
Comment on attachment 688457 [details] [diff] [review]
Included a return statement for a urlext try/catch

Review of attachment 688457 [details] [diff] [review]:
-----------------------------------------------------------------

Ian, because this bug only affects Android, I think the bug fix will most likely be in Android's js files in mobile-central/mobile/android/base/. The contentAreaUtils.js file is shared with the Firefox desktop browser.

::: toolkit/content/contentAreaUtils.js
@@ +1001,5 @@
>    var urlext;
>    try {
>      url = aURI.QueryInterface(Components.interfaces.nsIURL);
>      urlext = url.fileExtension;
> +    return urlext;

What is the value of the urlext variable? Something like "jpg"? If that extension value existed in mimeInfo, then mimeInfo.extensionExists(urlext) would return true (below) and this function would return urlext.

@@ +1006,5 @@
>    } catch (e) {
>    }
>  
>    if (urlext && mimeInfo && mimeInfo.extensionExists(urlext)) {
>      return urlext;

I suspect that getMIMEInfoForType(aContentType, ext) returned a mimeInfo that does not recognize urlext. Perhaps our Android code is passing a aContentType parameter to the getDefaultExtension() function that does not make sense for .jpg files? Note that this Android bug affects .jpg files, but not .gif or .png files.
Comment on attachment 688457 [details] [diff] [review]
Included a return statement for a urlext try/catch

Looks like we need answers to cpeterson's questions here - cancelling the review request.
Attachment #688457 - Flags: review?(gavin.sharp)
(Assignee)

Comment 7

4 years ago
Created attachment 691891 [details] [diff] [review]
nsMIMEInfoAndroid::ExtensionExists rewritten to check if requested mimeType exists.
Attachment #688457 - Attachment is obsolete: true
Attachment #691891 - Flags: review?(cpeterson)
(Reporter)

Comment 8

4 years ago
Comment on attachment 691891 [details] [diff] [review]
nsMIMEInfoAndroid::ExtensionExists rewritten to check if requested mimeType exists.

Review of attachment 691891 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me!
Attachment #691891 - Flags: review?(cpeterson) → review+
(Reporter)

Comment 9

4 years ago
Green try test:
https://tbpl.mozilla.org/?tree=Try&rev=411c3e473a4f
(Reporter)

Comment 10

4 years ago
Thanks, Ian! I checked your patch into mercurial for Firefox 20:

https://hg.mozilla.org/integration/mozilla-inbound/rev/11e520752312
status-firefox19: --- → wontfix
status-firefox20: --- → fixed
Target Milestone: --- → Firefox 20
https://hg.mozilla.org/mozilla-central/rev/11e520752312
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED

Comment 12

4 years ago
Firefox 20.0a1 (2012-12-17)
Device: Galaxy Nexus
OS: Android 4.1.1

Downloading a picture from jpeg.com it is saved with correct extension. Marking bug as VERIFIED FIXED.
Status: RESOLVED → VERIFIED
status-firefox20: fixed → verified
You need to log in before you can comment on or make changes to this bug.