Skip to content

Commit cf27bee

Browse files
committed
[FIXUP] add falsy image/jpg exception for download label - add missing MimeTypeDetector class
1 parent 016790c commit cf27bee

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Classes/Common/Helper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use TYPO3\CMS\Core\Messaging\FlashMessageService;
2727
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
2828
use TYPO3\CMS\Core\Resource\MimeTypeCollection;
29+
use TYPO3\CMS\Core\Resource\MimeTypeDetector;
2930
use TYPO3\CMS\Core\Utility\ArrayUtility;
3031
use TYPO3\CMS\Core\Utility\GeneralUtility;
3132
use TYPO3\CMS\Core\Utility\MathUtility;

Classes/Controller/ToolboxController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ private function getImage(int $page): array
145145
$image = $this->getFile($page, $this->useGroupsConfiguration->getImage());
146146
if (isset($image['mimetype'])) {
147147
$fileExtension = Helper::getFileExtensionsForMimeType($image['mimetype']);
148-
$image['mimetypeLabel'] = !empty($fileExtension) ? ' (' . strtoupper($fileExtension[0]) . ')' : '';
148+
if ($image['mimetype'] == 'image/jpg') {
149+
$image['mimetypeLabel'] = ' (JPG)'; // "image/jpg" is not a valid MIME type, so we need to handle it separately.
150+
} else {
151+
$image['mimetypeLabel'] = !empty($fileExtension) ? ' (' . strtoupper($fileExtension[0]) . ')' : '';
152+
}
149153
}
150154
return $image;
151155
}

0 commit comments

Comments
 (0)