Remove the charset from the content type for manifests
This commit is contained in:
parent
a67d57b91c
commit
5b4d39daa4
2 changed files with 7 additions and 5 deletions
|
@ -70,7 +70,7 @@ def fetch_manifest_by_tagname(namespace_name, repo_name, manifest_ref):
|
||||||
manifest_bytes.as_unicode(),
|
manifest_bytes.as_unicode(),
|
||||||
status=200,
|
status=200,
|
||||||
headers={
|
headers={
|
||||||
'Content-Type': '%s; charset=utf-8' % manifest_media_type,
|
'Content-Type': manifest_media_type,
|
||||||
'Docker-Content-Digest': manifest_digest,
|
'Docker-Content-Digest': manifest_digest,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -99,7 +99,7 @@ def fetch_manifest_by_digest(namespace_name, repo_name, manifest_ref):
|
||||||
metric_queue.repository_pull.Inc(labelvalues=[namespace_name, repo_name, 'v2', True])
|
metric_queue.repository_pull.Inc(labelvalues=[namespace_name, repo_name, 'v2', True])
|
||||||
|
|
||||||
return Response(manifest_bytes.as_unicode(), status=200, headers={
|
return Response(manifest_bytes.as_unicode(), status=200, headers={
|
||||||
'Content-Type': '%s; charset=utf-8' % manifest_media_type,
|
'Content-Type': manifest_media_type,
|
||||||
'Docker-Content-Digest': manifest_digest,
|
'Docker-Content-Digest': manifest_digest,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ class V2Protocol(RegistryProtocol):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Parse the returned manifest list and ensure it matches.
|
# Parse the returned manifest list and ensure it matches.
|
||||||
ct, _ = response.headers['Content-Type'].split(';', 1)
|
ct = response.headers['Content-Type']
|
||||||
assert ct == DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE
|
assert ct == DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE
|
||||||
retrieved = parse_manifest_from_bytes(Bytes.for_string_or_unicode(response.text), ct)
|
retrieved = parse_manifest_from_bytes(Bytes.for_string_or_unicode(response.text), ct)
|
||||||
assert retrieved.schema_version == 2
|
assert retrieved.schema_version == 2
|
||||||
|
@ -185,7 +185,8 @@ class V2Protocol(RegistryProtocol):
|
||||||
headers=headers)
|
headers=headers)
|
||||||
if expected_failure is not None:
|
if expected_failure is not None:
|
||||||
return None
|
return None
|
||||||
ct, _ = response.headers['Content-Type'].split(';', 1)
|
|
||||||
|
ct = response.headers['Content-Type']
|
||||||
manifest = parse_manifest_from_bytes(Bytes.for_string_or_unicode(response.text), ct)
|
manifest = parse_manifest_from_bytes(Bytes.for_string_or_unicode(response.text), ct)
|
||||||
assert not manifest.is_manifest_list
|
assert not manifest.is_manifest_list
|
||||||
assert manifest.digest == manifest_digest
|
assert manifest.digest == manifest_digest
|
||||||
|
@ -543,11 +544,12 @@ class V2Protocol(RegistryProtocol):
|
||||||
tag_name),
|
tag_name),
|
||||||
expected_status=(200, expected_failure, V2ProtocolSteps.GET_MANIFEST),
|
expected_status=(200, expected_failure, V2ProtocolSteps.GET_MANIFEST),
|
||||||
headers=headers)
|
headers=headers)
|
||||||
|
response.encoding = 'utf-8'
|
||||||
if expected_failure is not None:
|
if expected_failure is not None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Ensure the manifest returned by us is valid.
|
# Ensure the manifest returned by us is valid.
|
||||||
ct, _ = response.headers['Content-Type'].split(';', 1)
|
ct = response.headers['Content-Type']
|
||||||
if not self.schema2:
|
if not self.schema2:
|
||||||
assert ct in DOCKER_SCHEMA1_CONTENT_TYPES
|
assert ct in DOCKER_SCHEMA1_CONTENT_TYPES
|
||||||
|
|
||||||
|
|
Reference in a new issue