Review main Abandoned

97605[BUGFIX] Respect TSconfig allowed/disallowed for TCA type file

Benni Mack CR 0 V 0 Normal +212 −0 updated 11/14/26, 17:17

Commit message

The TCEFORM options "config.allowed" and "config.disallowed" in
page TSconfig are now applied to fields of TCA type "file", so
the element browser and the upload can be restricted to fewer
file extensions per page tree.

TSconfig can only narrow the TCA configuration: "allowed" is
intersected with the TCA list and "disallowed" is added to it.
An empty value or extensions not allowed by TCA do not lift a
restriction, as DataHandler validates file references against
TCA only. Placeholders like "common-image-types" are resolved
the same way as in TCA.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 910

  1. Benni Mack uploaded patch set 1 11/13/26, 10:30

  2. core-ci voted on patch set 1 V +1 11/13/26, 10:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114304

  3. Garvin Hicking voted on patch set 1 CR +1 V +1 11/13/26, 10:59

  4. Oli Bartsch commented on patch set 1 V -1 11/13/26, 16:39

    TcaFiles.php:121

    This adds a new TSconfig option rather than fixing a regression, since `type=file` never supported `config.allowed/disallowed` there (it isn't in `$allowOverrideMatrix`) and i'm not quite sure if we should support it at all. We usually only allow to change display settings. Such restrcitons lead to various problems. See my other comment with DataHandler.

    TcaFiles.php:131

    TCA values go through `TcaPreparation::prepareFileExtensions()`, which resolves `common-image-types` and friends, but TSconfig values are copied raw. `allowed = common-image-types` would then allow only that literal string, so nothing can be selected or uploaded.

    TcaFiles.php:132

    This wont work that way. This completely replace the TCA values so an empty `allowed` or extra extensions lift the TCA restriction. On save, DataHandler filters against the TCA config and silently deletes the `sys_file_reference` for files TCA forbids, so editors can select a file and lose it without any message.
  5. Benni Mack uploaded patch set 2 CR +1 V +1 11/13/26, 19:17

  6. Benni Mack commented on patch set 1 11/13/26, 19:17

    TcaFiles.php:121 Reply

    TSconfig can now only narrow the TCA restriction, never widen it, so it stays a FormEngine-level refinement like other TCEFORM options.

    TcaFiles.php:131 Reply

    Done.

    TcaFiles.php:132 Reply

    Done.
  7. Benni Mack commented on patch set 1 11/13/26, 19:18

    TcaFiles.php:121 Reply

    well, the question is if we forgot about that one or we did that intentionally back then in v12 when we built type=file. I don't know anymore. But the persistence issue is real indeed (unfortunately), however I can see to limit uploads / file endpoints to just a certain file type.
  8. Oli Bartsch commented on patch set 2 11/14/26, 10:23

    TcaFiles.php:121 Reply

    I'm not convinced we should add this tbh. Having a option which is not respected by DataHandler makes IMO no sense. One can just send e.g. via ajax and circumvent this narrowed config.
  9. Benni Mack commented on patch set 2 11/14/26, 17:17

    TcaFiles.php:121 Reply

    you are right, if we do this, we should do it right, and need to work on the DataHandler side - making this a feature. abandoning this change now.
  10. Benni Mack abandoned the change 11/14/26, 17:17