Avoid failing hard if the target empty dir cannot be deleted when extracting archives, fixes #9947
parent
c4f675fe84
commit
e013b479da
|
@ -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…
Reference in New Issue