Project

General

Profile

Actions

Bug #105532

closed

FileUpload: Not all options from MimeTypeValidator can be set

Added by Jörg Hofrichter 20 days ago. Updated 18 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
Extbase
Target version:
-
Start date:
2024-11-01
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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;
 
Actions #1

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

Actions #2

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

Actions #3

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

Actions #4

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.

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Torben Hansen 18 days ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF