Last modified: 2014-10-11 14:06:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37607, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35607 - MediaWiki incorrectly detects OOXML types of files saved by OpenOffice
MediaWiki incorrectly detects OOXML types of files saved by OpenOffice
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: multimedia 43154 43153
  Show dependency treegraph
 
Reported: 2012-03-30 11:38 UTC by Vitaliy Filippov
Modified: 2014-10-11 14:06 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Test document (3.64 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-06-07 10:30 UTC, Vitaliy Filippov
Details

Description Vitaliy Filippov 2012-03-30 11:38:00 UTC
MSOffice puts [Content_Types].xml at the beginning of ZIP file, but OpenOffice does not - it usually puts it at the end. So MimeMagic::detectZipType() can't guess the type as appropriate, because it checks only the first ZIP entry. Such files are detected as application/zip and can't be uploaded because of mime type and extension mismatch.
Comment 1 Andre Klapper 2012-11-19 15:41:47 UTC
Vitaliy:
I guess I need to allow a specific content type on a private wiki installation first? If so, what are the exact steps to reproduce this, as per default this format is not supported (see bug 2089 and bug 17497)?
(Note: This is documented on https://www.mediawiki.org/wiki/Manual:Configuring_file_uploads#Configuring_file_types )

With which MediaWiki version was this tested?

I tried to upload the file "test.odt", created with LibreOffice 3.4.6 OOO340m1 (Build:602), via https://test2.wikipedia.org/wiki/Special:Upload .
I get the error
"Permitted file types: png, gif, jpg, jpeg, xcf, pdf, mid, ogg, ogv, svg, djvu, tiff, tif, ogg, ogv, oga, webm."
Comment 2 Bawolff (Brian Wolff) 2012-11-19 21:45:45 UTC
(In reply to comment #1)
> Vitaliy:
> I guess I need to allow a specific content type on a private wiki installation
> first? If so, what are the exact steps to reproduce this, as per default this
> format is not supported (see bug 2089 and bug 17497)?

I am 90% sure those bugs have been fixed as of MW 1.18, but haven't tested (Well the second one has some legacy stuff that probably hasn't been, but that is irrelevant to the current bug).

> (Note: This is documented on
> https://www.mediawiki.org/wiki/Manual:Configuring_file_uploads#Configuring_file_types
> )
> 
> With which MediaWiki version was this tested?
> 
> I tried to upload the file "test.odt", created with LibreOffice 3.4.6 OOO340m1
> (Build:602), via https://test2.wikipedia.org/wiki/Special:Upload .
> I get the error
> "Permitted file types: png, gif, jpg, jpeg, xcf, pdf, mid, ogg, ogv, svg, djvu,
> tiff, tif, ogg, ogv, oga, webm."

Yes, we don't allow open document on wikimedia servers except possibly the foundation site. (That's a separate issue).

You would want to add the line:
$wgFileExtensions[] = 'odt';

to enable odt documents to be uploaded.

However, I think this bug is about openXML files, not OpenDocument files. We don't use [Content_Types].xml for detecting odt files, only for detecting the OpenXML files. Presumably this bug is about saving in MS format from open office?
-----
This bug is still likely open as MimeMagic is still doing what Vitaliy describes ( https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/MimeMagic.php;h=65a2a6fa79b7bb69118768b69736e7431d396c29;hb=HEAD#l801 ). The relevant question is if MediaWiki code is in the wrong or not (and If I correctly understood comment 0 as referring to openXML as saved by open office).
Comment 3 Platonides 2012-11-20 17:59:58 UTC
My first impression was that OpenOffice was wrong here. However, the mime type registration for OOXML does not provide any specific magic number.
It is exactly the same as for zip. Which has been making this painful the whole time. Compare with http://www.iana.org/assignments/media-types/application/vnd.oasis.opendocument.text for instance, where OpenDocument, by placing the as mimetype as the first entry, made it easy to detect.
Comment 4 Vitaliy Filippov 2013-06-07 10:30:15 UTC
Created attachment 12491 [details]
Test document

The bug is still relevant in git master, and I think that even if OO.o is wrong here MediaWiki should support these "wrong" versions... Because newer versions of OO.o/LO.o behave the same, and MSWord accept such documents. And MW still detects them as application/zip, so the bug should really be fixed. An example document (an empty one) is attached.
Comment 5 Gerrit Notification Bot 2013-06-27 15:48:30 UTC
Change 70830 had a related patch set uploaded by VitaliyFilippov:
(bug 35607) Fix OXML type detection

https://gerrit.wikimedia.org/r/70830

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


Navigation
Links