Office Open XML file extensions
Categories
(Firefox :: File Handling, defect)
Tracking
()
People
(Reporter: damiengoor, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36
Steps to reproduce:
PHP generates a spreadsheet in openXml format with the following headers:
Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;
File extension set to '.xml', still Firefox replaces the '.xml' extension with '*.xlsx' extension which prevents the file to correctly open in Excel as xlsx is not the expected format.
Comment 1•5 years ago
|
||
I don't understand how .xlsx
is not the correct extension for that MIME type for that file. Looking at https://www.iana.org/assignments/media-types/media-types.xhtml you probably meant application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml
(Note the trialing +xml
) ?
Comment 2•5 years ago
|
||
Maybe the mapping from application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
is indeed not completely correct. Or there are multiple file extensions? https://www.iana.org/assignments/media-types/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet lists .xltx
. https://en.wikipedia.org/wiki/Office_Open_XML lists both .xlsx
and .xlsm
.
Comment 3•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Updated•5 years ago
|
Updated•4 years ago
|
Comment 4•4 years ago
|
||
Seems like we either need to stop enforcing file extensions for OOXML or make sure we definitely have all the right extensions listed. Adding .xml seems problematic, but maybe that case was actually an issue with the reporter's code.
Updated•4 years ago
|
Comment 5•4 years ago
|
||
Can you provide a testcase?
Comment 6•4 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #4)
Seems like we either need to stop enforcing file extensions for OOXML or make sure we definitely have all the right extensions listed. Adding .xml seems problematic, but maybe that case was actually an issue with the reporter's code.
Yeah, I don't really understand what is going on here. Unless we list XML I don't think the original case is going to be fixed...
Maybe we just end up having to drop all the non-media types. :-\
Comment 7•4 years ago
|
||
Without more information about the specifics, we can't do much here.
Comment 8•4 years ago
|
||
Hi Damien, did Firefox 85 fix this for you (via the bug 1684183 patch)?
Reporter | ||
Comment 9•4 years ago
|
||
Attached, sample of exported file.
File is correct but Firefox changes the file extension to ".xlsx" while extension is explicitly set to ".xml" in PHP code.
PHP code that exports the data to the browser:
header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8");
header("Content-Disposition: attachment; filename=".$settings['file'].rand(1001,1000000).".xml");
header("Pragma: no-cache");
header("Expires: 0");
print $data;
Reporter | ||
Comment 10•4 years ago
|
||
Nope Sorry, I missed previous emails. tested with FF 85.0.2=> result is the same
Comment 11•4 years ago
|
||
Changing your code to
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
would fix this.
Comment 12•4 years ago
|
||
Actually just application/xml
might be better. Seems like sheet.main+xml is for something else
This subtype is intended for an OPC part of an OOXML document rather
than an entire OOXML document.
Description
•