Skip to content

Commit 9f42e02

Browse files
authored
Set mediaType for empty.ImageIndex in RawManifest (#1562)
Set previously unset mediaType for empty.ImageIndex so that the mediaType will be present in the raw manifest. empty.ImageIndex.MediaType() was unimpacted because it already returned OCIImageIndex directly.
1 parent 2ceebaa commit 9f42e02

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pkg/v1/empty/index.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ func (i emptyIndex) ImageIndex(v1.Hash) (v1.ImageIndex, error) {
5959
func base() *v1.IndexManifest {
6060
return &v1.IndexManifest{
6161
SchemaVersion: 2,
62+
MediaType: types.OCIImageIndex,
6263
}
6364
}

pkg/v1/mutate/mutate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func TestAnnotations(t *testing.T) {
289289
}, {
290290
desc: "index",
291291
in: empty.Index,
292-
want: `{"schemaVersion":2,"manifests":null,"annotations":{"foo":"bar"}}`,
292+
want: `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.index.v1+json","manifests":null,"annotations":{"foo":"bar"}}`,
293293
}, {
294294
desc: "arbitrary",
295295
in: arbitrary{},

0 commit comments

Comments
 (0)