#108913Inconsistency in SysFileMimeTypeMigration: Case-sensitivity of MIME types leads to validation errors
Description
Problem
When opening the Reports module, an error is triggered: Invalid query result, misses matching mime_type .
This occurs because the SysFileMimeTypeMigration logic (and subsequent validation) appears to be case-sensitive regarding the mime_type stored in the database, whereas file extensions are handled via mb_strtolower . In some environments or legacy databases, MIME types might be stored as image/JPG (uppercase) instead of image/jpeg or image/jpg .
Steps to reproduce
- Have a record in sys_file where the mime_type column contains uppercase strings (e.g., image/JPG ).
- Run the Reports module or file-related integrity checks in TYPO3 v13.4.
- The system fails to map the MIME type correctly.
If a manual compatibility mapping is added to settings.php as follows:
'FileInfo' => [
'mimeTypeCompatibility' => [
'image/jpg' => [
'jpg' => 'image/jpeg',
],
],
],
The error changes to: Mime-type “image/jpg” not allowed for file extension “jpg” (expected: image/jpeg) .
Root Cause Analysis
During debugging, it was found that the system could not find a match for image/JPG . While SysFileMimeTypeMigration uses mb_strtolower for file extensions, it does not normalize the mime_type .
Furthermore, a GROUP BY on the sys_file table might not reveal these duplicates/mismatches unless the BINARY keyword is used, making it harder for administrators to identify the corrupted data manually.
Suggested Solution
The mime_type should be normalized (lower-cased) during the migration process or during the lookup in the FileInfo service to ensure consistency, similar to how file extensions are handled.
Workaround
Currently, adding an uppercase entry to the configuration fixes the issue:
'image/JPG' => [
'jpg' => 'image/jpeg',
],
Stefan
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 2
-
Stefan Froemken commented and changed removed the assignee 02/09/26, 11:58
-
Stefan Froemken commented and changed status
NewClosed 02/09/26, 13:09Forget it…seems I found it:
case 'mimetype': $fileExt = strtolower($fileResponse['extension'][0] ?? ''); if (in_array($fileExt, ['jpg', 'jpeg', 'bmp', 'svg', 'ico', 'pdf', 'png', 'tiff'])) { return 'image/' . $fileExt; } return 'text/' . $fileExt;I will replace it with MimeTypeDetector.
I removed myself, as that is a little bit more than I expect. It’s not only the additional mb_strtolower, it relates also into ResourceConsistencyService.php and maybe some more else files. It seems that upper-case mime_type should be prevented in that column in general. So, maybe it also needs an UpgradeWizard?