Open
Bug 381936
Opened 17 years ago
Updated 2 months ago
Content-Disposition filename not obeyed when choosing to "Open" a file whose extension doesn't match Content-Type
Categories
(Firefox :: File Handling, defect)
Tracking
()
NEW
People
(Reporter: nen, Unassigned)
Details
Attachments
(1 obsolete file)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11 When clicking on a link that returns "Content-Disposition: attachment; filename=", and the extension of the filename doesn't follow Content-Type, Firefox adds a new extension when the link is chosen to open with a Helper Application. "Save as" correctly obeys the given filename, the problem only occurs with "Open with". Also, this happens only on Windows, not on Linux or Mac versions. Reproducible: Always Steps to Reproduce: 1. Access a website that returns a file.eml with Content-Type: text/plain (such as in the Additional Information) 2. Choose to "Open with" an application that shows the filename Actual Results: File is saved to temp as .eml.txt and opened in the chosen application Expected Results: File shoud be saved to temp as .eml and opened in the chosen application <?php header('Content-Disposition: attachment; filename="test.eml"'); header('Content-Type: text/plain'); //header('Content-Type: message/rfc822'); ?> message content
Comment 1•17 years ago
|
||
I believe this is intentional, see http://lxr.mozilla.org/seamonkey/source/uriloader/exthandler/nsExternalHelperAppService.cpp#1579 for why.
Product: Firefox → Core
QA Contact: file.handling → file-handling
Summary: Content-Disposition filename not obeyed when its extension doesn't follow Content-Type → Content-Disposition filename not obeyed when choosing to "Open" a file whose extension doesn't match Content-Type
Comment 2•17 years ago
|
||
A better, non-expiring link to that would be: http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp&rev=1.314#1659
I appreciate the security features, they are useful for people who use the default handler for downloaded files without much thought into the information displayed about the file. When however a user specifically chooses another handler after having seen the original filename and content type, I think it's safe to say that they know what they're doing, and their choice should be respected without doing something unexpected such as a file rename.
Comment 4•13 years ago
|
||
In firefox, the filename changes from test.xml to test.xml.xls In IE8, the filename is changed from test.xml to test.xls The problem is: if the server sends for example an excel table in XML format, and the filename is changed to .xls, excel complains about a mismatch between the file extension and the file contents.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•8 years ago
|
Product: Core → Firefox
Updated•2 years ago
|
Severity: normal → S3
Comment hidden (spam) |
Updated•2 months ago
|
Attachment #9386964 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•