Skip to content

Commit

Permalink
Referrer API must return correct Content-Type
Browse files Browse the repository at this point in the history
As per the spec, Content-Type header MUST be set to application/vnd.oci.image.index.v1+json

This is important as GAR today (OCI 1.0) redirect "referrers" API call to the authentication page, and doing so the call return 200 OK  + content-type: text/html.
  • Loading branch information
GregoireW authored Jun 28, 2024
1 parent 1b4e407 commit 1d4a18f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/v1/remote/referrers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (f *fetcher) fetchReferrers(ctx context.Context, filter map[string]string,
}

var b []byte
if resp.StatusCode == http.StatusOK {
if resp.StatusCode == http.StatusOK && resp.Header.Get("Content-Type") == string(types.OCIImageIndex) {
b, err = io.ReadAll(resp.Body)
if err != nil {
return nil, err
Expand Down

0 comments on commit 1d4a18f

Please sign in to comment.