From 421cc4597e52a9f46c9bea6a35b7c13071ba120f Mon Sep 17 00:00:00 2001 From: Jon Johnson Date: Fri, 24 Jan 2025 10:15:43 -0800 Subject: [PATCH] Return an if fetching index fails We weren't actually checking the response code, so we get weird gzip errors instead of the HTTP status. Signed-off-by: Jon Johnson --- pkg/apk/apk/index.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/apk/apk/index.go b/pkg/apk/apk/index.go index e16a1dcfa..94d653419 100644 --- a/pkg/apk/apk/index.go +++ b/pkg/apk/apk/index.go @@ -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 {