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
main
Chauncey McAskill 4 years ago
parent c46b75de81
commit 1bb87babe6

@ -142,6 +142,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$reject = null;
$download = function () use ($io, $output, $httpDownloader, $cache, $cacheKeyGenerator, $eventDispatcher, $package, $fileName, &$urls, &$accept, &$reject) {
$url = reset($urls);
$index = key($urls);
if ($eventDispatcher) {
$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();
}
$urls[$index] = $url;
$checksum = $package->getDistSha1Checksum();
$cacheKey = $url['cacheKey'];

Loading…
Cancel
Save