Bug #100683
closedrenameFile aborts if target file = original file, even if sanitizing the filename would result in different target filename
100%
Description
Currently, it is not possible to sanitize a file, simply be renaming it (to the current filename) because the function ResourceStorage::renameFile returns immediately if the new file name is the same as the old filename.
code:
public function renameFile($file, $targetFileName, $conflictMode = DuplicationBehavior::RENAME)
{
// The name should be different from the current.
if ($file->getName() === $targetFileName) {
return $file;
}
$sanitizedTargetFileName = $this->driver->sanitizeFileName($targetFileName);
This leads to inconsistent behaviour.
Example:
- Rename "ö.png" to "ö.png" results in "ö.png" (not sanitized)
- but renaming "ö.png" to "ö1.png" result in "oe1.png"
The file should be renamed, if renaming it results in a different filename. This is the case if target filename = original filename, but sanitizedTargetFileName != originalfilename.
Also, if this behaviour were changed, it would be much easier to sanitize filenames. One just need to use the rename function.
- Versions
- 11.5.26
- main (12-dev)
Updated by Gerrit Code Review over 1 year ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/78766
Updated by Gerrit Code Review over 1 year ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/79787
Updated by Sybille Peters over 1 year ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ec81e63db80acc8bb5477a3b0eed3d8fbcca97d1.