Review 13.4 Merged

89552[BUGFIX] Fix file uploads where concrete MIME types can't be determined

Benjamin Franzke CR +2 V +2 Hard +384 −31 updated 05/27/25, 06:10

Commit message

Recognize files that are detected with a generic MIME type
(e.g. text/plain instead of text/csv despite their csv file extension
and contents) to be allowed for uploading with the MIME type hardening
added in #106240.

The file extension-based MIME type mapping
(`SYS/FileInfo/fileExtensionToMimeType`) is now superseded (but still
supported) by a more fine-grained MIME type compatibility list that
allows to associate generic (as detected by PHP MIME detectors) MIME
types with a set of allowed extension keys and their associated specific
MIME types.

This means generic matches (like `text/xml`) can be transformed to
specific MIME types (e.g. `application/rss+xml`), based on a combined
file extension and file content detection.

This mapping is based on the mime-db MIME type to extension mapping that
is combined with heuristics to map structured syntax suffixes
(+xml, +yaml, +json) from their generic (detected) MIME type to concrete
ones and to map a text/plain to text/* mime-types.

mime-db based heuristics are:

     * Map text/plain to matching text/* MIME types
     * Map text/plain to matching *+yaml MIME types
     * Map text/plain to matching *+json MIME types
     * Map text/xml to matching *+xml MIME types

The mapping is extendable via:

```
SYS/FileInfo/mimeTypeCompatibility/{mimeType}/{extension}={newMimeType}
```

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
  • Verified V +2 Done
    • Benjamin Franzke +2
    • core-ci +1 CI

Issues 2

Files 7

Review log 45

  1. Benjamin Franzke commented on patch set 1 05/27/25, 04:43

    Cherry Picked from branch main.
  2. Benjamin Franzke marked it work in progress 05/27/25, 04:45

  3. core-ci voted on patch set 1 V +1 05/27/25, 04:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/79532

  4. Benjamin Franzke commented on patch set 1 CR +2 V +2 05/27/25, 06:10

    This change is ready for review.
  5. Benjamin Franzke merged patch set 2 05/27/25, 06:10