Skip to content

Commit

Permalink
improve error handling in bucketfallbackmapper
Browse files Browse the repository at this point in the history
  • Loading branch information
volmedo committed Feb 1, 2025
1 parent 76fa2af commit c9599c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/aws/bucketfallbackmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@ func (cfm BucketFallbackMapper) GetClaims(ctx context.Context, contentHash multi
}

resp, err := cfm.httpClient.Head(cfm.bucketURL.JoinPath(toBlobKey(contentHash)).String())
if err != nil || resp.StatusCode < 200 || resp.StatusCode >= 300 {
if err != nil {
return nil, err
}

Check warning on line 53 in pkg/aws/bucketfallbackmapper.go

View check run for this annotation

Codecov / codecov/patch

pkg/aws/bucketfallbackmapper.go#L52-L53

Added lines #L52 - L53 were not covered by tests
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, types.ErrKeyNotFound
}

size := uint64(resp.ContentLength)
delegation, err := cassert.Location.Delegate(
cfm.id,
Expand Down

0 comments on commit c9599c7

Please # to comment.