Skip to content

fix(handlers): display error details when invalid media types are detected during a manifest push

Before:

HTTP/1.1 400 Bad Request
Content-Length: 82
Content-Type: application/json
Date: Fri, 30 Jul 2021 18:15:22 GMT
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff

{
    "errors": [
        {
            "code": "MANIFEST_INVALID",
            "detail": {},
            "message": "manifest invalid"
        }
    ]
}

After:

HTTP/1.1 400 Bad Request
Content-Length: 179
Content-Type: application/json
Date: Fri, 30 Jul 2021 18:15:07 GMT
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff

{
    "errors": [
        {
            "code": "MANIFEST_INVALID",
            "detail": "mediaType in manifest should be 'application/vnd.docker.distribution.manifest.v2+json' not 'fooo'",
            "message": "manifest invalid"
        }
    ]
}

Merge request reports

Loading