Skip to content

Commit

Permalink
Set mediaType for empty.ImageIndex in RawManifest (#1562)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aw185176 committed Feb 9, 2023
1 parent 2ceebaa commit 9f42e02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/v1/empty/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ func (i emptyIndex) ImageIndex(v1.Hash) (v1.ImageIndex, error) {
func base() *v1.IndexManifest {
return &v1.IndexManifest{
SchemaVersion: 2,
MediaType: types.OCIImageIndex,
}
}
2 changes: 1 addition & 1 deletion pkg/v1/mutate/mutate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func TestAnnotations(t *testing.T) {
}, {
desc: "index",
in: empty.Index,
want: `{"schemaVersion":2,"manifests":null,"annotations":{"foo":"bar"}}`,
want: `{"schemaVersion":2,"mediaType":"application/vnd.oci.image.index.v1+json","manifests":null,"annotations":{"foo":"bar"}}`,
}, {
desc: "arbitrary",
in: arbitrary{},
Expand Down

0 comments on commit 9f42e02

Please sign in to comment.