Openoffice mime types not handled

Bug #314220 reported by James
6
Affects Status Importance Assigned to Milestone
MediaWiki
Confirmed
Wishlist
mediawiki (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: mediawiki

The list of allowed file extensions for upload is very small. I added the default OOo extensions, but still could not upload OOo files because the mime types were not handled in includes/mime.types. I added them as;
application/zip zip jar xpi sxc stc sxd std sxi sti sxm stm sxw stw odg odt odp ods

This does not cover the OOo templates, etc., just some of the basic document types.

Related branches

Revision history for this message
In , Andreas Wenning (andreas-wenning) wrote :

The following file types should be added to the line application/zip in mime.types:
odg odt odp ods otg ott otp ots

Even the documentation contains examples using them for uploads:
http://www.mediawiki.org/wiki/Manual:$wgFileExtensions

Changed in mediawiki:
status: New → Confirmed
Revision history for this message
Andreas Wenning (andreas-wenning) wrote :

Reported upstream.

Changed in mediawiki:
status: Unknown → Confirmed
Revision history for this message
In , Siebrand Mazeland (s-mazeland) wrote :

WONTFIX. Every sysadmin can decide for him/herself which uploads to $wgFileExtensions. MediaWiki by default uses a very conservative set for security reasons.

Revision history for this message
In , Andreas Wenning (andreas-wenning) wrote :

Sorry, you misunderstood me! I was in NO way suggesting to have them added to $wgFileExtensions. It is very reasonable to not add them there.

The suggestion was solely to add them to mime.types, so if the sysadmin chooses to add them to $wgFileExtensions it will actually work.

I don't see the reason for having the Openoffice.org type 1.x mime types listed in mime.types, while not having the OASIS mime types?

Revision history for this message
In , Siebrand Mazeland (s-mazeland) wrote :

Please provide a patch.

Revision history for this message
In , Andreas Wenning (andreas-wenning) wrote :

Created attachment 5815
oasis support in mime.types

Here is a patch against current trunk/phase3

Revision history for this message
In , Siebrand Mazeland (s-mazeland) wrote :

Applied in r47288.

Revision history for this message
Andreas Wenning (andreas-wenning) wrote :

And fixed in upstream SVN: "Applied in r47288."
Should be part of the 1.15.x release of mediawiki.

Changed in mediawiki:
status: Confirmed → Fix Released
Revision history for this message
In , Brion Vibber (brion) wrote :

This looks bogus; if added they should list their actual types (eg application/vnd.oasis.opendocument.text) not application/zip.

Revision history for this message
In , Agarrett-wikimedia (agarrett-wikimedia) wrote :

Fixed in r47398.

Revision history for this message
Thomas Bechtold (toabctl) wrote :
Revision history for this message
Daniel Holbach (dholbach) wrote :

Good work, Thomas and good work Andreas.

Thomas, a few things:
 - Try making use of https://wiki.ubuntu.com/PackagingGuide/PatchSystems (quilt) the next time
 - also there's https://wiki.ubuntu.com/DebianMaintainerField (the 'update-maintainer' script in ubuntu-dev-tools can do that for you)
 - https://wiki.ubuntu.com/UbuntuDevelopment/PatchTaggingGuidelines is important too.

Attaching my version of the fix.

Uploading.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mediawiki - 1:1.13.3-1ubuntu1

---------------
mediawiki (1:1.13.3-1ubuntu1) jaunty; urgency=low

  * includes/mime.types: Add mimetypes for opendocument files (LP: #314220 ).

 -- Thomas Bechtold <email address hidden> Sat, 21 Feb 2009 15:49:26 +0100

Changed in mediawiki:
status: Confirmed → Fix Released
Revision history for this message
In , Anon Sricharoenchai (anon-hui) wrote :

(In reply to comment #6)
> This looks bogus; if added they should list their actual types (eg
> application/vnd.oasis.opendocument.text) not application/zip.
>

What to do about oo.o 1.x format, sxc stc sxd std sxi sti sxm stm sxw stw ?
According to /usr/share/file/magic (in redhat or ubuntu), it seem to be, application/vnd.sun.xml.xxx. It should also be changed accordingly?

# OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7)
>>>50 string vnd.sun.xml. OpenOffice.org 1.x
>>>>62 string writer Writer
>>>>>68 byte !0x2e document
>>>>>68 string .template template
>>>>>68 string .global global document
>>>>62 string calc Calc
>>>>>66 byte !0x2e spreadsheet
>>>>>66 string .template template
>>>>62 string draw Draw
>>>>>66 byte !0x2e document
>>>>>66 string .template template
>>>>62 string impress Impress
>>>>>69 byte !0x2e presentation
>>>>>69 string .template template
>>>>62 string math Math document

# OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8)
# http://lists.oasis-open.org/archives/office/200505/msg00006.html
>>>50 string vnd.oasis.opendocument. OpenDocument
>>>>73 string text
>>>>>77 byte !0x2d Text
>>>>>77 string -template Text Template
>>>>>77 string -web HTML Document Template
>>>>>77 string -master Master Document
>>>>73 string graphics Drawing
>>>>>81 string -template Template
>>>>73 string presentation Presentation
>>>>>85 string -template Template
>>>>73 string spreadsheet Spreadsheet
>>>>>84 string -template Template
>>>>73 string chart Chart
>>>>>78 string -template Template
>>>>73 string formula Formula
>>>>>80 string -template Template
>>>>73 string database Database
>>>>73 string image Image

Revision history for this message
In , Anon Sricharoenchai (anon-hui) wrote :

/etc/mime.types in Ubuntu contains the following entries,

application/vnd.sun.xml.calc sxc
application/vnd.sun.xml.calc.template stc
application/vnd.sun.xml.draw sxd
application/vnd.sun.xml.draw.template std
application/vnd.sun.xml.impress sxi
application/vnd.sun.xml.impress.template sti
application/vnd.sun.xml.math sxm
application/vnd.sun.xml.writer sxw
application/vnd.sun.xml.writer.global sxg
application/vnd.sun.xml.writer.template stw

Revision history for this message
In , Anon Sricharoenchai (anon-hui) wrote :

However, the command "file -bi" on Redhat or Linux, does return application/x-zip for those openoffice files.
So, there should be an option for sysadmin to put additional custom mime.types entries.

Letting sysadmin to edit the file "includes/mime.types" is not a good idea,
since it will decrease the maintainability, especially when upgrading the MediaWiki software.
The custom mime.types entries should be placed in a separate file. The file name may be specified in a variable, $wgCustomMimeTypes, for example.

Revision history for this message
In , Anon Sricharoenchai (anon-hui) wrote :

Since "file -bi" on some Linux distribution does return application/x-zip for the zip archive,
then the x-zip should also be associated with the zip archive (in addition to application/zip) in includes/mime.types,

application/zip zip jar xpi
application/x-zip zip jar xpi

Changed in mediawiki:
status: Fix Released → Confirmed
Revision history for this message
In , Brion Vibber (brion) wrote :

Patch looks wrong; our mime.types map already correctly lists the OpenDocument formats with their own types, and we have detection specifically for such files.

If adding the old legacy formats (as in comment 9) these should also be added with their own mime types, and detection should be added in MimeMagic::detectZipType(). (Do the old formats use the same system for embedding the mime type in the zip file header?)

Revision history for this message
In , Anon Sricharoenchai (anon-hui) wrote :

(In reply to comment #12)
> If adding the old legacy formats (as in comment 9) these should also be added
> with their own mime types, and detection should be added in
> MimeMagic::detectZipType(). (Do the old formats use the same system for
> embedding the mime type in the zip file header?)
>

According to the magic file from redhat, the legacy formats use the same system
for embedding the mime type in zip file header.

Changed in mediawiki:
importance: Unknown → Wishlist
Revision history for this message
In , Sumana Harihareswara (sumanah) wrote :

Brion reviewed the patch, so adding the "reviewed" keyword.

Revision history for this message
In , Nemo_bis (nemobis) wrote :

Hmm, blocks a bug blocked by bug 2089, I'm slightly confused but a link is needed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.