Bug #105532
closedFileUpload: Not all options from MimeTypeValidator can be set
100%
Description
The MimeTypeValidator offers the following options:
- allowedMimeTypes
- ignoreFileExtensionCheck
- notAllowedMessage
- invalidExtensionMessage
However, when using the FileUpload annotation, only the first option is actually passed to the MimeTypeValidator.
Example:
#[Extbase\FileUpload([
'validation' => [
'required' => false,
'fileSize' => ['minimum' => '0K', 'maximum' => '8M'],
'allowedMimeTypes' => ['image/png'],
'ignoreFileExtensionCheck' => True,
'notAllowedMessage' => 'LLL:EXT:dummy/Resources/Private/Language/locallang.xlf:validation.mimetype.notAllowedMessage',
'invalidExtensionMessage' => 'LLL:EXT:dummy/Resources/Private/Language/locallang.xlf:validation.mimetype.invalidextension',
],
'uploadFolder' => '1:/user_upload/extbase_multiple_files/',
])]
protected ObjectStorage $files;
Updated by Gerrit Code Review 20 days ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86872
Updated by Gerrit Code Review 20 days ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86872
Updated by Gerrit Code Review 20 days ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86872
Updated by Torben Hansen 20 days ago
- Assignee set to Torben Hansen
This seems to be a conceptional problem with integration of the MimeTypeValidator in the FileUpload
attribute. The other validators (e.g. FileSize
or ImageDimensions
) allow users to pass all validator possible options to the validator instantiation. For the MimeTypeValidator
this is not possible, since we use an option of the validator directly instead.
Better would have been as following:
#[Extbase\FileUpload([ 'validation' => [ 'required' => false, 'fileSize' => ['minimum' => '0K', 'maximum' => '8M'], 'mimeType' => ['allowedMimeTypes' => ['image/png'], 'ignoreFileExtensionCheck' => true], ], 'uploadFolder' => '1:/user_upload/extbase_multiple_files/', ])]
I'll check with the core team, if we can fix this by adding an additional instantiation of the MimeTypeValidator
as shown above.
Updated by Gerrit Code Review 20 days ago
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 20 days ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 19 days ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 18 days ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 18 days ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 18 days ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86873
Updated by Gerrit Code Review 18 days ago
Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86868
Updated by Torben Hansen 18 days ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8b89eaff20a300631f5b9d0470647bd25af2335f.