Last modified: 2012-02-22 18:30:37 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 T32043, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30043 - Upload warning incorrect "File extension does not match MIME type." with URL encoded filenames
Upload warning incorrect "File extension does not match MIME type." with URL ...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.17.x
All All
: Normal critical with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-25 01:06 UTC by badon
Modified: 2012-02-22 18:30 UTC (History)
4 users (show)

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


Attachments

Description badon 2011-07-25 01:06:31 UTC
When using "Source URL" "sideloading" to upload a file using the file's URL, if the file name contains URL-encoded characters, the warning "File extension does not match MIME type." is given. Removing the URL-encoded characters from the file name allows the upload to proceed, but the checkbox "Ignore any warnings" does not work. 

I discovered the bug with this file, which has an URL encoded comma %2C after the word "Park":

http://commons.wikimedia.org/wiki/File:Gyps_rueppellii_-Nairobi_National_Park,_Kenya-8-4c.jpg

I'm not sure how this should be solved, since I don't know what characters are not allowed in a file name, if any. It may depend on the system. It might be a good idea to strip out characters that are allowed in URLs, but not in file names.
Comment 1 badon 2011-09-07 05:27:46 UTC
I increased this from "normal" to "critical" since there is no workaround for it. Users will always receive this error when they try to upload something with url-encoding (which is almost everything these days). This feature essentially does not work most of the time, at this point.
Comment 2 Bagariavivek 2012-02-22 14:01:13 UTC
@Badon:The problem is not in characters of the file..

*The Problem is in Guessing of Mime Type 

In function verifyFile,the following code guesses the mime type 
$var = FSFile::getPropsFromPath(temppath and extension)

Case1:When i upload images from google image search for example - http://www.hollywoodreporter.com/sites/default/files/2011/05/googlelogoa_a_l.jpg
        '''$var contains the right MIME Type'''


Case2:When i upload a pic from wikipedia 
http://commons.wikimedia.org/wiki/File:Gyps_rueppellii_-Nairobi_National_Park,_Kenya-8-4c.jpg

        $var contains *WRONG* MIME Type.It contains MIME type of text/html(The same error comes when we try to upload a html page)which is blacklisted by default.
I think it is interpreting  these kinds of images as HTML pages
Comment 3 Bagariavivek 2012-02-22 14:25:46 UTC
http://commons.wikimedia.org/wiki/File:Gyps_rueppellii_-Nairobi_National_Park,_Kenya-8-4c.jpg

The above link is of a html page.The link for image is 
http://upload.wikimedia.org/wikipedia/commons/3/33/Gyps_rueppellii_-Nairobi_National_Park%2C_Kenya-8-4c.jpg

Which works fine..so I guess this is not a bug at all
Comment 4 badon 2012-02-22 18:30:37 UTC
Thanks for checking into that. It looks like I reported this bug before I understood the difference between a file page and the actual file. I marked the bug as invalid.

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


Navigation
Links