Skip to content

Commit 950230c

Browse files
committed
image: make layer validation work
Most recently, the validation was broken because the image-spec was re-vendored but the code handling MediaType validation was not updated. This change (among others) broke umoci's tests because we run the validation code to ensure our images are always valid, and the validation incorrectly flagged our images as invalid. Fixes: ff477b3 ("vendor:update") Signed-off-by: Aleksa Sarai <[email protected]>
1 parent f3b6fb9 commit 950230c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

image/manifest.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,15 @@ func (m *manifest) validate(w walker) error {
7575
return errors.Wrap(err, "config validation failed")
7676
}
7777

78+
validLayerMediaTypes := []string{
79+
v1.MediaTypeImageLayer,
80+
v1.MediaTypeImageLayerGzip,
81+
v1.MediaTypeImageLayerNonDistributable,
82+
v1.MediaTypeImageLayerNonDistributableGzip,
83+
}
84+
7885
for _, d := range m.Layers {
79-
if err := d.validate(w, []string{v1.MediaTypeImageLayer}); err != nil {
86+
if err := d.validate(w, validLayerMediaTypes); err != nil {
8087
return errors.Wrap(err, "layer validation failed")
8188
}
8289
}

0 commit comments

Comments
 (0)