MediaHandler::getThumbType now checks if the extension and the mime type match. If they do not, a new extension is generated for the mime type. The rest of the thumbnailing code should then magically work.
Bonus: this also works with file names without extension, so might be a step closer to extension-less files.
enabled, but user cannot see rc patrol links.
* (bug 26548) ForeignAPIRepo (InstantCommons) now works with PDF files
and other multi-paged file formats.
+* Files with a mime type that does not match the extension are now properly
+ thumbnailed
=== API changes in 1.18 ===
* (bug 26339) Throw warning when truncating an overlarge API result
* @return array thumbnail extension and MIME type
*/
function getThumbType( $ext, $mime, $params = null ) {
+ $magic = MimeMagic::singleton();
+ if ( !$ext || $magic->isMatchingExtension( $ext, $mime ) === false ) {
+ // The extension is not valid for this mime type and we do
+ // recognize the mime type
+ $extensions = $magic->getExtensionsForType( $mime );
+ if ( $extensions ) {
+ return array( strtok( $extensions, ' ' ), $mime );
+ }
+ }
+
+ // The extension is correct (true) or the mime type is unknown to
+ // MediaWiki (null)
return array( $ext, $mime );
}