Skip to content

Commit

Permalink
fix: add media type in the generated OCI index
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <lixlei@microsoft.com>
  • Loading branch information
Wwwsylvia authored and shizhMSFT committed Feb 18, 2025
1 parent 43e6842 commit c34e75d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func (s *Store) loadIndexFile(ctx context.Context) error {
Versioned: specs.Versioned{
SchemaVersion: 2, // historical value
},
MediaType: ocispec.MediaTypeImageIndex,
Manifests: []ocispec.Descriptor{},
}
return s.writeIndexFile()
Expand Down
3 changes: 3 additions & 0 deletions content/oci/oci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ func TestStore_Success(t *testing.T) {
if want := 2; index.SchemaVersion != want {
t.Errorf("index.SchemaVersion = %v, want %v", index.SchemaVersion, want)
}
if want := "application/vnd.oci.image.index.v1+json"; index.MediaType != want {
t.Errorf("index.MediaType = %s, want %s", index.MediaType, want)
}

// test push blob
err = s.Push(ctx, blobDesc, bytes.NewReader(blob))
Expand Down

0 comments on commit c34e75d

Please sign in to comment.