Skip to content

Commit ce7c7d9

Browse files
authored
Merge pull request #344 from Jurj-Bogdan/github-avatar-fix
Skip setting github avatar if error returned by API call
2 parents 0260835 + 5b5118b commit ce7c7d9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Integration/IntegrationConnectionTrait.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,17 @@ private function getPackageImage(string $package): string
8383
$rawResult = curl_exec($this->githubCurl);
8484
assert(is_string($rawResult));
8585

86-
/** @var array{data: array{repository: array{owner: array{avatarUrl: string}}}}|null $githubResult */
86+
/**
87+
* @var array{data: array{repository: array{owner: array{avatarUrl: string}}}}|array{errors: array{mixed}}|null
88+
* $githubResult
89+
*/
8790
$githubResult = json_decode($rawResult, true, 512, JSON_THROW_ON_ERROR);
8891
$image = '';
8992

90-
if ($githubResult === null) {
93+
if ($githubResult === null || isset($githubResult['errors'])) {
9194
return $image;
9295
}
96+
assert(isset($githubResult['data']['repository']['owner']['avatarUrl']));
9397

9498
return $this->cachePackageOwnerAvatar(
9599
$githubResult['data']['repository']['owner']['avatarUrl'],

0 commit comments

Comments
 (0)