From 6a7220fed8b6fa00ad4dd962ac147593b0616131 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 2 Aug 2019 15:57:33 +0200 Subject: [PATCH] Avoid wiping the whole target package if download of the new one fails, refs #7929 --- src/Composer/Downloader/FileDownloader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index da2955638..6a08bd67d 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -175,7 +175,9 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface $reject = function ($e) use ($io, &$urls, $download, $fileName, $path, $package, &$retries, $filesystem, $self) { // clean up - $filesystem->removeDirectory($path); + if (file_exists($fileName)) { + $filesystem->unlink($fileName); + } $self->clearLastCacheWrite($package); if ($e instanceof TransportException) {