Review 13.4 Merged

90012[BUGFIX] Allow replacing files with different mime-type and extension

Oliver Hader CR +2 V +2 Normal +121 −25 updated 07/08/25, 08:39

Commit message

Replacing an existing file.pdf (having mime-type `application/pdf`)
with another file.png (having mime-type `image/png`) is denied due
to the mismatching mime-type to extension consistency check.

The file abstraction layer performed two distinct operations
(first replace file contents, then rename file name) which caused
this problem.

The new `ResourceStorage::replaceAndRenameUploadedFile()` method is
dedicated for that purpose, enabling the resource storage to
know about the overall intention and allowing to perform a proper
consistency check.

In case the flag "keep the current filename" is enabled in the user
interface, the filename part is kept, however the fileextension is
adjusted if necessary.

As a drive-by change, the resource integrity error messages are
now properly revelead in errors stemming from the "Rename" action.
This is implemented without the need for a XLF label change just by
string concatenation.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2
    • core-ci +1 CI

Issues 1

Files 7

Review log 46

  1. Oliver Hader uploaded patch set 1 07/08/25, 07:47

  2. core-ci voted on patch set 1 V -1 07/08/25, 08:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81463

  3. Oliver Hader uploaded patch set 2 V -1 07/08/25, 08:24

  4. core-ci voted on patch set 2 V +1 07/08/25, 08:34 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/81472

  5. Oliver Hader voted on patch set 2 CR +2 V +2 07/08/25, 08:36

  6. Oliver Hader merged patch set 3 07/08/25, 08:39