Skip to content

Commit

Permalink
Return an if fetching index fails (#1495)
Browse files Browse the repository at this point in the history
We weren't actually checking the response code, so we get weird gzip
errors instead of the HTTP status.

Signed-off-by: Jon Johnson <[email protected]>
  • Loading branch information
jonjohnsonjr authored Jan 24, 2025
1 parent 5de148d commit a25294d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/apk/apk/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ func (i *indexCache) get(ctx context.Context, repoName, repoURL string, keys map
return nil, err
}

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("unexpected status code %d", resp.StatusCode)
}

fetchAndParse := func(etag string) (NamedIndex, error) {
b, err := fetchRepositoryIndex(ctx, u, etag, opts)
if err != nil {
Expand Down

0 comments on commit a25294d

Please sign in to comment.