Open Bug 1148264 Opened 9 years ago Updated 2 years ago

Firefox does not add a file extension to the download property of an a frame when it should

Categories

(Firefox :: File Handling, defect)

36 Branch
x86
macOS
defect

Tracking

()

UNCONFIRMED

People

(Reporter: anthony, Unassigned)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20150320202338

Steps to reproduce:

Create a <a> frame and set the download parameter to something without an extension.

Example: <a href="http://i.imgur.com/cEaV1kw.jpg" download="goodgame">


Actual results:

The file is saved without the extension.

In the previously mentioned example, the file is downloaded as "goodgame"


Expected results:

According to WC3, it should have read the MIME type and properly set the download's extension.

http://www.w3.org/TR/html5/links.html#downloading-resources

In the example, the file should have been downloaded as "goodgame.jpg" or "goodgame.jpeg"
Severity: normal → minor
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
You're presumably talking about step 19 of the algorithm, right?

Did you get a prompt asking what to call the file?  Because see step 17 of that algorithm.
Flags: needinfo?(anthony)
In any case, the DOM code is in fact passing the correct extension (.jpg in this case) to the UI code.  See the aSuggestedFileExtension argument to promptForSaveToFileAsync. What the UI then decides to do with it ... depends (e.g. I'm pretty sure on Windows it in fact appends it to things in various cases, via the Windows filepicker).
Component: DOM: Core & HTML → File Handling
Product: Core → Firefox
I do not get a prompt asking what to name the file.

Instead, I get a prompt like this: http://i.imgur.com/xztQOyk.png
Flags: needinfo?(anthony)
Attached image File prompt given
The file prompt given, which does not allow the user to change the file name.
Right, but after you pick the "Save" option, there is no filepicker prompting you where to save the file and what to call it?  There is for me, with this testcase:

  data:text/html,<a href="data:image/jpeg,something" download="name">Click me</a>

but it's possible I have some non-default setting causing that...
No, there is not. It saves directly to "~/Downloads"
(More specifically, to "~/Downloads/goodgame", continuing the example case)
I've included an HTML file that causes the issue on both my computer (OS X) as well as Anthony's, you'll need the image that goes with it in the same directory for this to work properly.
Attached image cEaV1kw.jpg
Image file for use with index.html attached previously
OK.  Definitely sounds like a front-end bug, then.  If they're going to skip the prompt, they should be sanitizing the name as needed; all the relevant information is there.
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: