Closed Bug 1686437 Opened 5 years ago Closed 4 years ago

Office Open XML file extensions

Categories

(Firefox :: File Handling, defect)

Firefox 84
Desktop
Unspecified
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: damiengoor, Unassigned)

References

Details

Attachments

(2 files)

48.75 KB, image/jpeg
Details
8.42 MB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Details
Attached image xml-xlsx.JPG

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.

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) ?

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.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Product: Firefox → WebExtensions
Component: Untriaged → File Handling
Product: WebExtensions → Firefox
Summary: open xml header → Office Open XML file extensions

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.

Flags: needinfo?(gijskruitbosch+bugs)
Flags: needinfo?(gijskruitbosch+bugs)

Can you provide a testcase?

Blocks: 1652520
Flags: needinfo?(damiengoor)
Hardware: Unspecified → Desktop

(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. :-\

Without more information about the specifics, we can't do much here.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INCOMPLETE

Hi Damien, did Firefox 85 fix this for you (via the bug 1684183 patch)?

Attached file sql416045.xlsx

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;

Flags: needinfo?(damiengoor)

Nope Sorry, I missed previous emails. tested with FF 85.0.2=> result is the same

Changing your code to

header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");

would fix this.

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.

https://www.iana.org/assignments/media-types/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: