Skip to content

Commit

Permalink
Add accept header for registry
Browse files Browse the repository at this point in the history
  • Loading branch information
axtloss committed Apr 26, 2024
1 parent e4b5a11 commit da06c64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (r *Registry) GetManifest(token string) (*Manifest, error) {

req.Header.Set("User-Agent", "abroot")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
req.Header.Set("Accept", "application/vnd.oci.image.manifest.v1+json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
Expand All @@ -150,6 +151,10 @@ func (r *Registry) GetManifest(token string) (*Manifest, error) {
digest := resp.Header.Get("Docker-Content-Digest")

// we need to parse the layers to get the digests
if m["layers"] == nil {
PrintVerboseErr("Registry.GetManifest", 4, err)
return nil, fmt.Errorf("Manifest does not contain layer property")
}
layers := m["layers"].([]interface{})
var layerDigests []string
for _, layer := range layers {
Expand Down

0 comments on commit da06c64

Please sign in to comment.