@@ -24,6 +24,7 @@ import (
2424 "github.com/distribution/distribution/v3/registry/client/transport"
2525
2626 "github.com/opencontainers/go-digest"
27+ ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
2728
2829 "go.uber.org/ratelimit"
2930
@@ -35,6 +36,15 @@ import (
3536
3637// TODO: Check image's architecture and OS
3738
39+ // knownMediaTypes is the list of media types we can process
40+ var knownMediaTypes = []string {
41+ ocischema .SchemaVersion .MediaType ,
42+ schema1 .MediaTypeSignedManifest ,
43+ schema2 .SchemaVersion .MediaType ,
44+ manifestlist .SchemaVersion .MediaType ,
45+ ociv1 .MediaTypeImageIndex ,
46+ }
47+
3848// RegistryClient defines the methods we need for querying container registries
3949type RegistryClient interface {
4050 NewRepository (nameInRepository string ) error
@@ -159,11 +169,10 @@ func (clt *registryClient) ManifestForTag(tagStr string) (distribution.Manifest,
159169 if err != nil {
160170 return nil , err
161171 }
162- mediaType := []string {ocischema .SchemaVersion .MediaType , schema1 .MediaTypeSignedManifest , schema2 .SchemaVersion .MediaType , manifestlist .SchemaVersion .MediaType }
163172 manifest , err := manService .Get (
164173 context .Background (),
165174 digest .FromString (tagStr ),
166- distribution .WithTag (tagStr ), distribution .WithManifestMediaTypes (mediaType ))
175+ distribution .WithTag (tagStr ), distribution .WithManifestMediaTypes (knownMediaTypes ))
167176 if err != nil {
168177 return nil , err
169178 }
@@ -176,11 +185,10 @@ func (clt *registryClient) ManifestForDigest(dgst digest.Digest) (distribution.M
176185 if err != nil {
177186 return nil , err
178187 }
179- mediaType := []string {ocischema .SchemaVersion .MediaType , schema1 .MediaTypeSignedManifest , schema2 .SchemaVersion .MediaType , manifestlist .SchemaVersion .MediaType }
180188 manifest , err := manService .Get (
181189 context .Background (),
182190 dgst ,
183- distribution .WithManifestMediaTypes (mediaType ))
191+ distribution .WithManifestMediaTypes (knownMediaTypes ))
184192 if err != nil {
185193 return nil , err
186194 }
0 commit comments