Page MenuHomePhabricator

CSV files are recognized as "text/plain" and cannot be uploaded with the .csv file extension
Closed, ResolvedPublic

Description

Author: drewkongs

Description:
When attempting to upload a CSV file, MediaWiki throws the following error:

"File extension ".csv" does not match the detected MIME type of the file (text/plain)."

This forces the user to change the file extension from ".csv" to ".txt" in order to store this file in the wiki, which is incorrect

Tested with CSV from various programs, including Microsoft Excel export.


Version: 1.20.x
Severity: normal
OS: Linux
Platform: PC

Details

Reference
bz45424

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:26 AM
bzimport set Reference to bz45424.
bzimport added a subscriber: Unknown Object (MLST).

From which operating system is the csv file uploaded?

drewkongs wrote:

Tried this on both Mac OS X (10.8) with chrome and Windows 7 with firefox.

(In reply to comment #2)

Tried this on both Mac OS X (10.8) with chrome and Windows 7 with firefox.

Its matters more what os your server is as file type detection is done on the server side. (Sometimes mw uses the underlying os for file type detection. Im not sure what the default is off the top of my head)

Mw hasnt overly been tested with file formats other than standard image formats so its probably just an oversight.

(As quick hack work arround - if its important to make this work quickly you could change csv to be associated with text/plain in includes/mime.types . Obviously that is not a proper fix)

drewkongs wrote:

(In reply to comment #3)

The host machine is running Debian Linux 6.0.6 (aka squeeze) and php 5.4.10

mark.rowlands wrote:

have the same issue with Windows 2012. as well as

File extension ".xlsx" does not match the detected MIME type of the file (application/vnd.ms-excel).

File extension ".docx" does not match the detected MIME type of the file (application/msword).

docx is application/vnd.openxmlformats-officedocument.wordprocessingml.document
xlsx is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

http://technet.microsoft.com/en-us/library/ee309278%28office.12%29.aspx

Change 141765 had a related patch set uploaded by Brian Wolff:
Fix mime detection of easily-confused-with text/plain formats

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

Change 141765 merged by jenkins-bot:
Fix mime detection of easily-confused-with text/plain formats

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

This should be fixed on mediawiki 1.24

Gilles raised the priority of this task from Medium to Unbreak Now!.Dec 4 2014, 10:19 AM
Gilles added a project: Multimedia.
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to Medium.Dec 4 2014, 11:21 AM