Review main Merged

93042[BUGFIX] Prevent InsufficientFolderAccessPermissionsException in form preview

Josua Vogel CR +2 V +2 Normal +128 −13 updated 03/04/26, 13:10

Commit message

When a non-admin backend editor previews a form containing a
FileUpload element that targets a file storage the editor has no
access to, an InsufficientFolderAccessPermissionsException is thrown.

This happens because FileUpload::initializeFormElement() resolves
the upload target folder via ResourceFactory, which checks file
storage permissions. The catch block in checkSaveFileMountAccess()
only caught \InvalidArgumentException, letting access permission
and folder-not-found exceptions bubble up.

Three changes fix this:

1. FileUpload::checkSaveFileMountAccess() now additionally catches
   InsufficientFolderAccessPermissionsException and
   FolderDoesNotExistException, returning false instead of
   throwing.

2. FileUpload::initializeFormElement() skips the entire upload
   folder resolution when the rendering option "previewMode" is
   enabled, since file uploads are non-functional during preview.

3. To make the previewMode option available during form element
   initialization, ArrayFormFactory::build() now applies
   renderingOptions before processing renderables, and
   FormEditorController::renderFormPageAction() sets previewMode
   in the configuration array before calling build().

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Josef Glatz +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Josef Glatz +1
    • core-ci +1 CI

Issues 1

Files 4

Review log 810

  1. Josua Vogel uploaded patch set 1 03/03/26, 14:33

  2. core-ci voted on patch set 1 V +1 03/03/26, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97190

  3. Georg Ringer voted on patch set 1 CR +1 V +1 03/03/26, 16:50

  4. Josef Glatz voted on patch set 1 CR +1 V +1 03/03/26, 18:39

  5. Josua Vogel updated the commit message in patch set 2 CR +1 V +1 03/03/26, 18:44

  6. core-ci voted on patch set 2 V +1 03/03/26, 18:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97211

  7. Josef Glatz voted on patch set 2 CR +1 V +1 03/03/26, 19:14

  8. Garvin Hicking voted on patch set 2 CR +1 V +1 03/03/26, 22:03

  9. Garvin Hicking voted on patch set 2 CR +2 V +2 03/04/26, 13:10

  10. Garvin Hicking merged patch set 3 03/04/26, 13:10