List of steps to reproduce (step by step, including full links if applicable):
- Download sample free font https://everythingfonts.com/font/good-times-rg-regular
- Ensure LocalSettings.php allows ttf upload $wgFileExtensions = array_merge($wgFileExtensions, ['ttf']);
- Upload the ttf file
What happens?:
- File extension ".TTF" does not match the detected MIME type of the file (font/sfnt).
What should have happened instead?:
- File should be recognized and allow upload
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
MediaWiki 1.37.2 - but is also on master
Investigation and temp fix
Looks like application/font-sfnt; is actually deprecated, but is the only one supported in MimeMap.php
https://en.wikipedia.org/wiki/SFNT
https://gerrit.wikimedia.org/g/mediawiki/core/%2B/HEAD/includes/libs/mime/MimeMap.php#138
Ubuntu 20.04 LTS file -bi good\ times\ rg.ttf font/sfnt; charset=binary
Temp workaround by
$wgHooks['MimeMagicInit'][] = function ( MimeAnalyzer $mime ) { $mime->addExtraTypes( 'font/sfnt ttf' ); };