Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/shared/repository/GithubRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getReleasesByRequestedPhar(RequestedPhar $requestedPhar): Releas
continue;
}
$pharUrl = null;
$signatureUrl = null;
$signatureUrl = [];

foreach ($entry['assets'] as $asset) {
$url = $asset['browser_download_url'];
Expand All @@ -48,7 +48,7 @@ public function getReleasesByRequestedPhar(RequestedPhar $requestedPhar): Releas
}

if (in_array(substr($url, -4, 4), ['.asc', '.sig'], true)) {
$signatureUrl = new Url($url);
$signatureUrl[$url] = new Url($url);
}
}

Expand All @@ -61,6 +61,12 @@ public function getReleasesByRequestedPhar(RequestedPhar $requestedPhar): Releas
continue;
}

// if the release has multiple signatures, use the one that's closest to the
// name of the phar, e.g. doctum.phar.asc instead of doctum.phar.sha256.asc
$signatureUrl = $signatureUrl[$pharUrl . '.asc']
?? $signatureUrl[$pharUrl . '.sig']
?? array_shift($signatureUrl);

// we do have a phar but no signature, could potentially be used
if (!$signatureUrl instanceof Url) {
$releases->add(
Expand Down