Update src/Composer/Downloader/ArchiveDownloader.php
Fix to single-file archivepull/977/head
parent
ece954a7a4
commit
091b2e86db
|
@ -47,6 +47,12 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
if (1 === count($contentDir)) {
|
||||
$contentDir = $contentDir[0];
|
||||
|
||||
if(is_file($contentDir)){
|
||||
rename($contentDir, $path . '/' . basename($fileName));
|
||||
unlink($contentDir);
|
||||
}
|
||||
else{
|
||||
|
||||
// Rename the content directory to avoid error when moving up
|
||||
// a child folder with the same name
|
||||
$temporaryName = md5(time().rand());
|
||||
|
@ -59,10 +65,7 @@ abstract class ArchiveDownloader extends FileDownloader
|
|||
}
|
||||
}
|
||||
|
||||
if(is_file($contentDir)){
|
||||
unlink($contentDir);
|
||||
}
|
||||
else{
|
||||
|
||||
rmdir($contentDir);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue