Skip to content

Commit

Permalink
Merge pull request #718 from sjdaws/test-additional-headers
Browse files Browse the repository at this point in the history
Fix non-multiarch OCI images, reduce GET calls
  • Loading branch information
rusenask authored Apr 15, 2023
2 parents 6755298 + f966c0f commit 70c1b89
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions registry/docker/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@ func (r *Registry) ManifestDigest(repository, reference string) (digest.Digest,
return "", err
}

req.Header.Set("Accept", manifestv2.MediaTypeManifest)
req.Header.Set("Accept", strings.Join([]string{manifestv2.MediaTypeManifest, oci.MediaTypeImageIndex, oci.MediaTypeImageManifest}, ","))
resp, err := r.Client.Do(req)
if err != nil {
// Try OCI headers if error relates to OCI
if strings.Contains(err.Error(), "OCI index found, but accept header does not support OCI indexes") {
req.Header.Set("Accept", oci.MediaTypeImageIndex)
resp, err = r.Client.Do(req)
}
if err != nil {
return "", err
}
return "", err
}
defer resp.Body.Close()

Expand Down

0 comments on commit 70c1b89

Please sign in to comment.