1
0
Fork 0

Fix availability of $urls in FileDownloader

Fixed:
- Ensure manipulations to the first element of $urls in the $download callback are available in $accept and $reject
pull/9296/head
Chauncey McAskill 2020-10-15 16:11:16 -04:00
parent c46b75de81
commit 1bb87babe6
1 changed files with 3 additions and 0 deletions

View File

@ -142,6 +142,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$reject = null; $reject = null;
$download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) { $download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) {
$url = reset($urls); $url = reset($urls);
$index = key($urls);
if ($eventDispatcher) { if ($eventDispatcher) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package); $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed'], 'package', $package);
@ -154,6 +155,8 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$url['processed'] = $preFileDownloadEvent->getProcessedUrl(); $url['processed'] = $preFileDownloadEvent->getProcessedUrl();
} }
$urls[$index] = $url;
$checksum = $package->getDistSha1Checksum(); $checksum = $package->getDistSha1Checksum();
$cacheKey = $url['cacheKey']; $cacheKey = $url['cacheKey'];