This commit is contained in:
boxjan 2026-04-22 23:34:25 -05:00 committed by GitHub
commit 46f2de287d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,10 +262,14 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *regis
continue
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusTemporaryRedirect && resp.StatusCode != http.StatusOK {
switch resp.StatusCode {
case http.StatusTemporaryRedirect:
return resp.Location()
case http.StatusOK:
return resp.Request.URL, nil
default:
return nil, fmt.Errorf("unexpected status code %d", resp.StatusCode)
}
return resp.Location()
}
}()
if err != nil {