[Libreoffice-bugs] [Bug 127226] inconsistent behavior when opening odt vs. docx

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Aug 30 00:56:37 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=127226

--- Comment #2 from Tomaz Vajngerl <quikee at gmail.com> ---
The problem is that OOXML/MOX files can't be detected with examining magic
bytes like for example ODF file can (that's why it is required mimetype file
with appropriate content is at first place in the zip file). So when this
detection fails we rely on the extension (I'm not completely sure what the
detection does).

To solve this issue we need to detect the type by checking the actual content:
- check if it is a zip
- if yes, check if it contains a file [Content-Types].xml, 
- if yes, we know it's a OOXML file but not which type, so parse the xml file
to determine the type.

This is far from a simple detection so we need to do it when magic detection
fails. The trick is that we can easily detect it is a zip file and know it's
not a ODF file just by looking at the magic bytes. 

As for the extension - yes, we should probably warn that the file doesn't use
the correct extension.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190830/bd3890b0/attachment.html>


More information about the Libreoffice-bugs mailing list