Closed Bug 712748 Opened 13 years ago Closed 12 years ago

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

Categories

(Firefox for Android Graveyard :: General, defect, P4)

ARM
Android
defect

Tracking

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

VERIFIED FIXED
Firefox 20
Tracking Status
firefox11 --- affected
firefox12 --- affected
firefox13 --- affected
firefox14 --- affected
firefox15 --- affected
firefox16 --- affected
firefox17 --- affected
firefox18 --- affected
firefox19 --- wontfix
firefox20 --- verified
fennec + ---

People

(Reporter: cpeterson, Assigned: ipatterson)

Details

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

Attachments

(1 file, 2 obsolete files)

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
Issue is still reproducible on Firefox Native 14.0 beta 1 on HTC Desire running Android 2.2
Whiteboard: [14.0b1]
tracking-fennec: --- → ?
Assignee: nobody → cpeterson
tracking-fennec: ? → +
Assignee: cpeterson → nobody
Whiteboard: [14.0b1] → [mentor=cpeterson][lang=java][lang=javascript]
Whiteboard: [mentor=cpeterson][lang=java][lang=javascript] → [mentor=cpeterson][lang=java][lang=js]
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)
Assignee: nobody → ipatterson
Status: NEW → ASSIGNED
Re-uploading changes in patch form.
Attachment #688301 - Attachment is obsolete: true
Attachment #688457 - Flags: review?(gavin.sharp)
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)
Attachment #688457 - Attachment is obsolete: true
Attachment #691891 - Flags: review?(cpeterson)
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+
Thanks, Ian! I checked your patch into mercurial for Firefox 20:

https://hg.mozilla.org/integration/mozilla-inbound/rev/11e520752312
Target Milestone: --- → Firefox 20
https://hg.mozilla.org/mozilla-central/rev/11e520752312
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
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
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: