Issue Bug Resolved

#111286PlainTextExtractor may delete the original file of a local storage

Benni Mack 10/30/26, 08:28 updated 10/30/26, 10:55

Description

TYPO3\CMS\Core\Resource\TextExtraction\PlainTextExtractor::extractText() reads the file through $file->getForLocalProcessing(false) and removes the returned path afterwards if its base name differs from $file->getName(), assuming it is a temporary copy of a remote file:

if (PathUtility::basename($localTempFile) !== $file->getName()) {
unlink($localTempFile);
}

For a local storage, getForLocalProcessing(false) returns the path of the original file, not a copy. Whenever the name stored in sys_file
differs from the actual file name in the storage, e.g. because of an outdated index record or a different Unicode normalization of the
name, the original file is deleted from the storage when its text is extracted.

The extractor does not need a local file at all. Reading the contents with $file->getContents() works for local and remote storages and
leaves no temporary file behind.

Reviews 2

History 26

  1. Gerrit Code Review pushed patch set 1 for main to change 97227 status New Under Review 10/30/26, 09:11

  2. Gerrit Code Review pushed patch set 1 for 14.3 to change 97233 10/30/26, 10:15

  3. Gerrit Code Review pushed patch set 2 for 14.3 to change 97233 10/30/26, 10:16

  4. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 10/30/26, 10:20

    Applied in changeset commit:aaf19c3f420416e250e500e13ed080b4e9ec5051.

  5. Gerrit Code Review pushed patch set 3 for 14.3 to change 97233 status Resolved Under Review 10/30/26, 10:39

  6. Benni Mack commented and changed status Under Review Resolved 10/30/26, 10:55

    Applied in changeset commit:ae3fa280a4a29e4b39259d840a525bcefccc4297.