1
0
Fork 0

Handle 404s gracefully when loading providers in ComposerRepo, fixes #10974

pull/10996/head
Jordi Boggiano 2022-08-16 11:44:21 +02:00
parent f2141dd3ea
commit 104bf0d75d
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 1 deletions

View File

@ -607,7 +607,14 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$result = array();
if ($this->providersApiUrl) {
try {
$apiResult = $this->httpDownloader->get(str_replace('%package%', $packageName, $this->providersApiUrl), $this->options)->decodeJson();
} catch (TransportException $e) {
if ($e->getStatusCode() === 404) {
return $result;
}
throw $e;
}
foreach ($apiResult['providers'] as $provider) {
$result[$provider['name']] = $provider;