PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: google/go-containerregistry (go)

Issue:
ggcr: referrers Content-Type should indicate it is an OCI index
### Describe the bug

The referrers response should be an OCI index, but the Content-Type header says it's `text/plain`.

### To Reproduce

Run the server with referrers enabled, push content with referrers, and query with `curl -i` to see the headers.

### Expected behavior

The header should be `Content-Type: application/vnd.oci.image.index.v1+json`.

### Additional context

https://github.com/opencontainers/distribution-spec/pull/452


Pull request:
Return OCI Index content-type for referrers response
Resolves #1760

Patch:
diff --git a/pkg/registry/manifest.go b/pkg/registry/manifest.go
index 4e02eeed..db8a8dc6 100644
--- a/pkg/registry/manifest.go
+++ b/pkg/registry/manifest.go
@@ -437,6 +437,7 @@ func (m *manifests) handleReferrers(resp http.ResponseWriter, req *http.Request)
 	}
 	msg, _ := json.Marshal(&im)
 	resp.Header().Set("Content-Length", fmt.Sprint(len(msg)))
+	resp.Header().Set("Content-Type", string(types.OCIImageIndex))
 	resp.WriteHeader(http.StatusOK)
 	io.Copy(resp, bytes.NewReader([]byte(msg)))
 	return nil


Test patch:
diff --git a/pkg/registry/registry_test.go b/pkg/registry/registry_test.go
index 0ee492ed..a9c257b5 100644
--- a/pkg/registry/registry_test.go
+++ b/pkg/registry/registry_test.go
@@ -446,6 +446,9 @@ func TestCalls(t *testing.T) {
 				"foo/manifests/image":           "foo",
 				"foo/manifests/points-to-image": "{\"subject\": {\"digest\": \"sha256:" + sha256String("foo") + "\"}}",
 			},
+			Header: map[string]string{
+				"Content-Type": "application/vnd.oci.image.index.v1+json",
+			},
 		},
 		{
 			Description: "fetch references, subject pointing elsewhere",
@@ -456,6 +459,9 @@ func TestCalls(t *testing.T) {
 				"foo/manifests/image":           "foo",
 				"foo/manifests/points-to-image": "{\"subject\": {\"digest\": \"sha256:" + sha256String("nonexistant") + "\"}}",
 			},
+			Header: map[string]string{
+				"Content-Type": "application/vnd.oci.image.index.v1+json",
+			},
 		},
 		{
 			Description: "fetch references, no results",
@@ -465,6 +471,9 @@ func TestCalls(t *testing.T) {
 			Manifests: map[string]string{
 				"foo/manifests/image": "foo",
 			},
+			Header: map[string]string{
+				"Content-Type": "application/vnd.oci.image.index.v1+json",
+			},
 		},
 		{
 			Description: "fetch references, missing repo",