diff --git a/manifest/schema2/builder.go b/manifest/schema2/builder.go index 70b006a83..44b94eaae 100644 --- a/manifest/schema2/builder.go +++ b/manifest/schema2/builder.go @@ -55,6 +55,9 @@ func (mb *builder) Build(ctx context.Context) (distribution.Manifest, error) { // Add config to the blob store m.Config, err = mb.bs.Put(ctx, MediaTypeConfig, mb.configJSON) + // Override MediaType, since Put always replaces the specified media + // type with application/octet-stream in the descriptor it returns. + m.Config.MediaType = MediaTypeConfig if err != nil { return nil, err } diff --git a/manifest/schema2/builder_test.go b/manifest/schema2/builder_test.go index 6806033dc..02ed401bf 100644 --- a/manifest/schema2/builder_test.go +++ b/manifest/schema2/builder_test.go @@ -32,7 +32,7 @@ func (bs *mockBlobService) Put(ctx context.Context, mediaType string, p []byte) d := distribution.Descriptor{ Digest: digest.FromBytes(p), Size: int64(len(p)), - MediaType: mediaType, + MediaType: "application/octet-stream", } bs.descriptors[d.Digest] = d return d, nil