Review main Ready for review

97471[BUGFIX] Replace target file correctly when renaming a file

Benni Mack CR -1 V 0 Normal +50 −1 updated 11/10/26, 09:22

Commit message

Renaming a file to the name of an existing file with
DuplicationBehavior::REPLACE built the local source path from the
public URL of the file. This fails as soon as the storage has a
base URI, is not public or uses a non-local driver.

In the default setup it only appeared to work: the local driver
moved the source file onto the target, but the index entry of the
source file was never removed.

The target file is now replaced with a local copy of the renamed
file, and the renamed file is deleted afterwards via the storage, so
its index entry, metadata and references are cleaned up.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/71/97471/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/71/97471/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR -1 Needs a vote
    • Sascha Egerer -1
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 4

Issues 1

Files 2

Review log 23

  1. Benni Mack uploaded patch set 1 11/09/26, 20:41

  2. core-ci voted on patch set 1 V +1 11/09/26, 21:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113784

  3. Sascha Egerer commented on patch set 1 CR -1 11/09/26, 21:48

    ResourceStorage.php:2168 Unresolved

    $replacedFile can be null if $this->replaceFile($sourceFile, $localFilePath); failed, right? And null is not a valid return type here