outlookmediawikiemail-templatesmediawiki-installationoft

How to skip MIME type check for .OFT file extensions on MediaWiki


On my private wiki, I have enabled the uploading of Microsoft Outlook 2016 Email Templates (.oft) using $wgFileExtensions. But when uploading an oft file, I'm faced with the error File extension ".oft" does not match the detected MIME type of the file (application/sla).

Is there a way to fix or overcome this? Or perhaps a way to skip MIME checks for oft files only? And if so, would you be able to help me with the necessary code please?

I'd also like Outlook to run when clicking on the file link. But that isn't as importing as fixing the error... Thanks for any help.


Solution

  • After reading further, I finally found a non-hacky solution to upload .oft:

    1. If not already done, add .oft files to the list of supported extensions ( $wgFileExtensions)
    2. In MediaWiki 1.34.2, edit /includes/libs/mime/mime.types and modify application/sla stl to application/sla stl oft. (As far as I know, this directory is changed for 1.35+)

    That's it! Without lowering and amending security, I can now upload .oft files.

    Hope this helps others struggling with this.