List of steps to reproduce (step by step, including full links if applicable):
- use maintenance/importImages.php to import an exe file, e.g. php importImages.php /yourfolderhere --extensions=exe
- find it in your mediawiki installation, try to move it, notice the failure
What happens?:
- it fails because during the move the file is recognized as application/octet-stream, while during import it was stored in the database as unknown/unknown, and mediawiki doesn't accept this mismatch
- importImages.php uses the function guessMimeType() in /includes/libs/mime/MimeAnalyzer.php to first recognize it as application/octet-stream... (line 590)
- ... but subsequently it uses the function improveTypeFromExtension(), which in turn uses /includes/libs/mime/MimeMap.php, to in the end re-map application/octet-stream to unknown/unknown (line 465)
- meanwhile the move function keeps the file identified as application/octet-stream
What should have happened instead?:
- that's the big question... because this is actually an old issue, see https://phabricator.wikimedia.org/T247348
- the suggested commit from that old ticket was never merged by the look of it (as is now irrelevant because it seems llike the mime libs have changed quite a bit)
- and the proposed solution there didn't fix this problem, because identifying exe files as application/vnd.microsoft.portable-executable still breaks the move for the same reason as mentioned above
- my suggestion: simply remove 'application/octet-stream' => 'unknown/unknown', (line 465) from /includes/libs/mime/MimeMap.php - nothing more
- I've tested that, it solves this problem
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
version 1.37.1