mirror of
https://github.com/composer/composer
synced 2025-05-10 17:12:51 +00:00
Merge remote-tracking branch 'tot-ra/patch-2'
Conflicts: src/Composer/Downloader/ArchiveDownloader.php
This commit is contained in:
commit
ebc0f8884f
1 changed files with 14 additions and 9 deletions
|
@ -47,6 +47,9 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
if (1 === count($contentDir)) {
|
if (1 === count($contentDir)) {
|
||||||
$contentDir = $contentDir[0];
|
$contentDir = $contentDir[0];
|
||||||
|
|
||||||
|
if (is_file($contentDir)) {
|
||||||
|
$this->filesystem->rename($contentDir, $path . '/' . basename($contentDir));
|
||||||
|
} else {
|
||||||
// Rename the content directory to avoid error when moving up
|
// Rename the content directory to avoid error when moving up
|
||||||
// a child folder with the same name
|
// a child folder with the same name
|
||||||
$temporaryName = md5(time().rand());
|
$temporaryName = md5(time().rand());
|
||||||
|
@ -58,8 +61,10 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
$this->filesystem->rename($file, $path . '/' . basename($file));
|
$this->filesystem->rename($file, $path . '/' . basename($file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rmdir($contentDir);
|
rmdir($contentDir);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// clean up
|
// clean up
|
||||||
$this->filesystem->removeDirectory($path);
|
$this->filesystem->removeDirectory($path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue