1
0
Fork 0

Make sure a version not found issue is reported as such for clarity, fixes #9500

pull/9508/head
Jordi Boggiano 2020-11-19 09:39:03 +01:00
parent 351b14e32b
commit 35b403b266
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@ use Composer\SelfUpdate\Keys;
use Composer\SelfUpdate\Versions; use Composer\SelfUpdate\Versions;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Downloader\FilesystemException; use Composer\Downloader\FilesystemException;
use Composer\Downloader\TransportException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
@ -211,7 +212,13 @@ EOT
$io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString)); $io->write(sprintf("Upgrading to version <info>%s</info> (%s channel).", $updateVersion, $channelString));
$remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar'); $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
try {
$signature = $httpDownloader->get($remoteFilename.'.sig')->getBody(); $signature = $httpDownloader->get($remoteFilename.'.sig')->getBody();
} catch (TransportException $e) {
if ($e->getStatusCode() === 404) {
throw new \InvalidArgumentException('Version "'.$updateVersion.'" could not be found.', 0, $e);
}
}
$io->writeError(' ', false); $io->writeError(' ', false);
$httpDownloader->copy($remoteFilename, $tempFilename); $httpDownloader->copy($remoteFilename, $tempFilename);
$io->writeError(''); $io->writeError('');

View File

@ -110,7 +110,7 @@ class Compiler
$finder = new Finder(); $finder = new Finder();
$finder->files() $finder->files()
->ignoreVCS(true) ->ignoreVCS(true)
->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md|\.gitignore|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon)$/') ->notPath('/\/(composer\.(json|lock)|[A-Z]+\.md|\.gitignore|appveyor.yml|phpunit\.xml\.dist|phpstan\.neon\.dist|phpstan-config\.neon)$/')
->notPath('/bin\/(jsonlint|validate-json|simple-phpunit)(\.bat)?$/') ->notPath('/bin\/(jsonlint|validate-json|simple-phpunit)(\.bat)?$/')
->notPath('symfony/debug/Resources/ext/') ->notPath('symfony/debug/Resources/ext/')
->notPath('justinrainbow/json-schema/demo/') ->notPath('justinrainbow/json-schema/demo/')