From 06b4923c475dfb33589dff644ff184ec30e722f6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 22 Jun 2023 16:30:48 +0200 Subject: [PATCH] Add fallback dist type extension to temp archive files for URLs without extension, fixes #11513 (#11520) --- src/Composer/Downloader/FileDownloader.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index fa6dfa73b..0c989a82d 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -436,7 +436,12 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface */ protected function getFileName(PackageInterface $package, string $path): string { - return rtrim($this->config->get('vendor-dir') . '/composer/tmp-' . md5($package . spl_object_hash($package)) . '.' . $this->getDistPath($package, PATHINFO_EXTENSION), '.'); + $extension = $this->getDistPath($package, PATHINFO_EXTENSION); + if ($extension === '') { + $extension = $package->getDistType(); + } + + return rtrim($this->config->get('vendor-dir') . '/composer/tmp-' . md5($package . spl_object_hash($package)) . '.' . $extension, '.'); } /**