Closed
Bug 1077623
Opened 11 years ago
Closed 7 years ago
When I download a .jpg file in FirefoxOS it name the file with a .jpg.jpeg extension
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: dhylands, Unassigned)
References
Details
Under FirefoxOS, if I browse to a website, say:
http://www.davehylands.com/Robotics/Stinger/Small/01-Base.html
and then long press on the image and save it, then the image file (URL: http://www.davehylands.com/Robotics/Stinger/Small/01-Base.jpg) is saved in the download folder with the filename 01-Base.jpg.jpeg instead of keeping its original name.
I wasn't sure if this was an issue in dom/download directly or one of the sub-modules it uses, so I figured I'd start there.
![]() |
||
Comment 1•11 years ago
|
||
The download manager in Firefox knows not to do this, as does the MIME service in Gecko (which is what the download manager uses for this behavior), so presumably this is some b2g-specific code that's messing up...
Reporter | ||
Comment 2•11 years ago
|
||
The incorrect extension is added here:
http://dxr.mozilla.org/mozilla-central/source/dom/browser-element/BrowserElementParent.jsm#709
I modified it to look like:
> dump("DownloadListener: _options.filename = '" + _options.filename + "', ext = '" + ext + "'\n");
> // Check if we need to add an extension to the filename.
> if (ext && !_options.filename.endsWith(ext)) {
> dump("DownloadListener: adding extension '" + ext + "'");
> _options.filename += ext;
> }
and I get this output in the log:
> DownloadListener: _options.filename = '01-Drill-Tap-Hole.jpg', ext = '.jpeg'
> DownloadListener: adding extension '.jpeg'
![]() |
||
Comment 3•11 years ago
|
||
Dave, thank for the pointer. The problem is that this code:
ext = '.' + mimeSvc.getPrimaryExtension(channel.contentType, '');
is just buggy.
The right thing to do is to grab the existing extension from _options.filename, call mimesvc.getFromTypeAndExtension(), etc.
This stuff should not reinvent the wheels that the Firefox UI has already invented... In this case the getDefaultExtension function in toolkit/content/contentAreaUtils.js and associated machinery.
Comment 5•7 years ago
|
||
I don't think we are going to work on this anymore, closing.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•