1
0
Fork 0

Add fallback dist type extension to temp archive files for URLs without extension, fixes #11513 (#11520)

pull/11556/head
Jordi Boggiano 2023-06-22 16:30:48 +02:00 committed by GitHub
parent c7bbd60621
commit 06b4923c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -436,7 +436,12 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
*/ */
protected function getFileName(PackageInterface $package, string $path): string 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, '.');
} }
/** /**