Last modified: 2011-03-13 18:04:49 UTC
The uploadcorrupt message, "The file is corrupt or has an incorrect extension. Please check the file and upload again." is vague and confusing and commonly leads to support requests: <http://toolserver.org/~mzmcbride/cgi-bin/mw-logs.py?search=The%20file%20is%20corrupt%20or%20has%20an%20incorrect%20extension> It can be generated when either: * MimeMagic detected unknown/unknown but extension is listed as "recognizable", or * MimeMagic detected a type which was different to the type suggested by the extension. The details of why the upload was rejected are logged in exquisite detail to the debug log, but the user doesn't get to see any of that. Some users (presumably Windows users from the post Win 95 era) don't really understand file extensions and are easily confused by talk about them. Sometimes the error is the fault of the external detection utility and extra details need to be provided for debugging. I suggest: * Splitting messages for the unknown/unknown case from the "different MIME type" case * Mapping the most common file extensions and the most common MIME types to a set of localised messages, so that we can talk about e.g. "JPEG" instead of "image/jpeg" and ".jpg". * Providing the detected type, the file extension, and the type that the file extension implies, as message parameters.
Sounds good...
Created attachment 6556 [details] Patch for Splitting Messages I have begun working on this bug. I attach a simple patch that splits the messages. I am not yet so sure about localised messages or what to do to add the message to multiple languages, as I have not used them previously.
Created attachment 6557 [details] Patch that splits messages I have removed LocalSettings.php from the initial diff.
This patch seems to reject all files whose type is not detected, which is a change in behavior from the current code; if we're configured to allow non-blacklisted file extensions to be uploaded, and we can't detect a mime type out of it successfully, and it's not an extension that we know we can recognize for sure, then previously we'd let it through.
The uploadcorrupt message is no longer used in the current release of MediaWiki so does not require fixing.
Comment on attachment 6557 [details] Patch that splits messages No longer required as uploadcorrupt is no longer used.