Avoid failing hard if the target empty dir cannot be deleted when extracting archives, fixes #9947

main
Jordi Boggiano 3 years ago
parent c4f675fe84
commit e013b479da
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -137,9 +137,18 @@ abstract class ArchiveDownloader extends FileDownloader
};
$renameAsOne = false;
if (!file_exists($path) || ($filesystem->isDirEmpty($path) && $filesystem->removeDirectoryPhp($path))) {
if (!file_exists($path)) {
$renameAsOne = true;
}
if ($filesystem->isDirEmpty($path)) {
try {
if ($filesystem->removeDirectoryPhp($path)) {
$renameAsOne = true;
}
} catch (\RuntimeException $e) {
// ignore error, and simply do not renameAsOne
}
}
$contentDir = $getFolderContent($temporaryDir);
$singleDirAtTopLevel = 1 === count($contentDir) && is_dir(reset($contentDir));

Loading…
Cancel
Save