Merge pull request #1169 from coreos-inc/manifestct

Fix manifest content type
This commit is contained in:
josephschorr 2016-01-25 17:02:49 -05:00
commit 15db48a619

View file

@ -31,6 +31,8 @@ BASE_MANIFEST_ROUTE = '/<repopath:repository>/manifests/<regex("{0}"):manifest_r
MANIFEST_DIGEST_ROUTE = BASE_MANIFEST_ROUTE.format(digest_tools.DIGEST_PATTERN)
MANIFEST_TAGNAME_ROUTE = BASE_MANIFEST_ROUTE.format(VALID_TAG_PATTERN)
# From: https://github.com/docker/distribution/blob/47a064d4195a9b56133891bbb13620c3ac83a827/manifest/schema1/manifest.go#L18
MANIFEST_CONTENT_TYPE = 'application/vnd.docker.distribution.manifest.v1+prettyjws'
ISO_DATETIME_FORMAT_ZULU = '%Y-%m-%dT%H:%M:%SZ'
JWS_ALGORITHM = 'RS256'
@ -250,6 +252,7 @@ def fetch_manifest_by_tagname(namespace, repo_name, manifest_ref):
track_and_log('pull_repo', repo, analytics_name='pull_repo_100x', analytics_sample=0.01)
response = make_response(manifest.json_data, 200)
response.headers['Content-Type'] = MANIFEST_CONTENT_TYPE
response.headers['Docker-Content-Digest'] = manifest.digest
return response
@ -271,6 +274,7 @@ def fetch_manifest_by_digest(namespace, repo_name, manifest_ref):
track_and_log('pull_repo', repo)
response = make_response(manifest.json_data, 200)
response.headers['Content-Type'] = MANIFEST_CONTENT_TYPE
response.headers['Docker-Content-Digest'] = manifest.digest
return response