Bug #96727
openExistingTargetFolderException not handled correctly
0%
Description
In `TYPO3\CMS\Core\Resource\ResourceStorage::getNestedProcessingFolder` there is this code:
foreach ($nestedFolderNames as $folderName) {
if ($processingFolder->hasFolder($folderName)) {
$processingFolder = $processingFolder->getSubfolder($folderName);
} else {
$currentEvaluatePermissions = $processingFolder->getStorage()->getEvaluatePermissions();
$processingFolder->getStorage()->setEvaluatePermissions(false);
$processingFolder = $processingFolder->createFolder($folderName);
$processingFolder->getStorage()->setEvaluatePermissions($currentEvaluatePermissions);
}
}
and the call to `$processingFolder->createFolder()` can cause an ExistingTargetFolderException, which may be caused by parallel actions of multiple editors or whatever. Although the issue seem to be handled by `$processingFolder->hasFolder($folderName)` right above, the exception does occur in our sentry system nevertheless. Hence, this code block should be changed like this instead to prevent the process from terminating completely:
foreach ($nestedFolderNames as $folderName) {
if ($processingFolder->hasFolder($folderName)) {
$processingFolder = $processingFolder->getSubfolder($folderName);
} else {
$currentEvaluatePermissions = $processingFolder->getStorage()->getEvaluatePermissions();
$processingFolder->getStorage()->setEvaluatePermissions(false);
try {
$processingFolder = $processingFolder->createFolder($folderName);
$processingFolder->getStorage()->setEvaluatePermissions($currentEvaluatePermissions);
} catch (ExistingTargetFolderException $existingTargetFolderException) {
$processingFolder = $processingFolder->getSubfolder($folderName);
}
}
}
Updated by Gerrit Code Review 5 months 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/+/85101
Updated by Mathias Brodala 5 months ago
We see the same issue by using ichhabrecht/filefill. Here it is expected that files and folders are created by parallel requests.
Updated by Gerrit Code Review 5 months 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/+/85101
Updated by Gerrit Code Review about 1 month 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/+/85101
Updated by Gerrit Code Review about 1 month 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/+/85101