Issue Bug Closed

#110158Mime type validator is not called on upload element

Sebastien Convers 07/06/26, 09:25 updated 08/11/26, 08:51

Description

To reproduce:

  • make a form, (database or yaml, doesn’t matter), put a “file upload” or “image upload” element. Pick some Allowed file mime types or leave default list
  • save, use it on a page, go to front
  • click on the button to pick a file, and in the modale, change the setting to pick any type of file. Choose one that does not belong in previous mime types list
  • Submit

On TYPO3 13, mime type validator was triggered, and you could not upload a docx if list was restricted to pdf

From TYPO 14, validator is not triggered, because here https://github.com/TYPO3/typo3/blob/main/typo3/sysext/form/Classes/Domain/Model/FormElements/FileUpload.php#L64 allowedMimeTypes  is always empty

Reviews 2

History 1018

  1. Gerrit Code Review pushed patch set 1 for main to change 94684 status Accepted Under Review <span data-processor="relativetime" data-value="2026-07-06T11:18:53+00:00" > 07/06/26, 11:18 </span>

  2. Oliver Hader commented <span data-processor="relativetime" data-value="2026-07-07T07:56:57+00:00" > 07/07/26, 07:56 </span>

    I made this issue and the Gerrit change private/internal for the time being, due to it’s potential security impact.

  3. Oliver Hader commented <span data-processor="relativetime" data-value="2026-07-08T19:39:22+00:00" > 07/08/26, 19:39 </span>

    Okay, basically the issue was, that

    • \TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface::initializeFormElement is too early and $renderable->getProperties()['allowedMimeTypes'] is just not set yet
    • \TYPO3\CMS\Form\Mvc\Property\PropertyMappingConfiguration::afterFormStateInitialized is fine
  4. Josua Vogel commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-07-14T12:10:09+00:00" > 07/14/26, 12:10 </span>

    Applied in changeset commit:817ad41cc9dd28aac0fc4d0fe16fc25d46dd554a.