@@ -24,6 +24,7 @@ import (
24
24
"github.com/distribution/distribution/v3/registry/client/transport"
25
25
26
26
"github.com/opencontainers/go-digest"
27
+ ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
27
28
28
29
"go.uber.org/ratelimit"
29
30
@@ -35,6 +36,15 @@ import (
35
36
36
37
// TODO: Check image's architecture and OS
37
38
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
+
38
48
// RegistryClient defines the methods we need for querying container registries
39
49
type RegistryClient interface {
40
50
NewRepository (nameInRepository string ) error
@@ -159,11 +169,10 @@ func (clt *registryClient) ManifestForTag(tagStr string) (distribution.Manifest,
159
169
if err != nil {
160
170
return nil , err
161
171
}
162
- mediaType := []string {ocischema .SchemaVersion .MediaType , schema1 .MediaTypeSignedManifest , schema2 .SchemaVersion .MediaType , manifestlist .SchemaVersion .MediaType }
163
172
manifest , err := manService .Get (
164
173
context .Background (),
165
174
digest .FromString (tagStr ),
166
- distribution .WithTag (tagStr ), distribution .WithManifestMediaTypes (mediaType ))
175
+ distribution .WithTag (tagStr ), distribution .WithManifestMediaTypes (knownMediaTypes ))
167
176
if err != nil {
168
177
return nil , err
169
178
}
@@ -176,11 +185,10 @@ func (clt *registryClient) ManifestForDigest(dgst digest.Digest) (distribution.M
176
185
if err != nil {
177
186
return nil , err
178
187
}
179
- mediaType := []string {ocischema .SchemaVersion .MediaType , schema1 .MediaTypeSignedManifest , schema2 .SchemaVersion .MediaType , manifestlist .SchemaVersion .MediaType }
180
188
manifest , err := manService .Get (
181
189
context .Background (),
182
190
dgst ,
183
- distribution .WithManifestMediaTypes (mediaType ))
191
+ distribution .WithManifestMediaTypes (knownMediaTypes ))
184
192
if err != nil {
185
193
return nil , err
186
194
}
0 commit comments