https://bugzilla.wikimedia.org/show_bug.cgi?id=66428
Bug ID: 66428
Summary: MimeMagic: ZIP types not properly detected
Product: MediaWiki
Version: 1.24-git
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: File management
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected]
Web browser: ---
Mobile Platform: ---
Created attachment 15612
--> https://bugzilla.wikimedia.org/attachment.cgi?id=15612&action=edit
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.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l