ZIP-type file with fake extension.
In MimeMagic.php, there is a function that is supposed to detect zips - ::doGuessMimeType() - and zip types - ::detectZipType(). However, it fails when supplying small files like attached. Neither small ZIPs are detected nor other kind of zip-types.
So I did some debugging and found that $tail in ::doGuessMimeType() appears to be empty when the file size is below about 8192 bytes. Lowering the number of bytes from the end of the file to set the cursor to in the call to fseek to the actual file size "fixes" the issue.
Reproducible:
- Production: Always.
- Evidence: When uploading c.jpg to Commons, the following response is issued: File extension ".jpg" does not match the detected MIME type of the file (unknown/unknown).
- Evidence: When uploading c_big.jpg to Commons, the following response is issued: File extension ".jpg" does not match the detected MIME type of the file (application/vnd.oasis.opendocument.spreadsheet).
- Debug environment with PHP 5.4.20 (apache2handler): Always.
- Evidence: Debug logging and inspecting variables using xDebug and Eclipse.
Version: 1.24rc
Severity: normal
Attached: