Fix handling of four byte utf8 manifests

- Adds the charset: utf-8 to all the manifest responses
- Makes sure we connect to MySQL in utf8mb4 mode, to ensure we can properly read and write 4-byte utf8 strings
- Adds tests for all of the above
This commit is contained in:
Joseph Schorr 2019-01-10 16:34:56 -05:00
parent 62609fce3e
commit eb9ca8e8a8
8 changed files with 120 additions and 11 deletions

View file

@ -76,7 +76,7 @@ def fetch_manifest_by_tagname(namespace_name, repo_name, manifest_ref):
supported.bytes.as_unicode(),
status=200,
headers={
'Content-Type': supported.media_type,
'Content-Type': '%s; charset=utf-8' % supported.media_type,
'Docker-Content-Digest': supported.digest,
},
)
@ -111,7 +111,7 @@ def fetch_manifest_by_digest(namespace_name, repo_name, manifest_ref):
metric_queue.repository_pull.Inc(labelvalues=[namespace_name, repo_name, 'v2', True])
return Response(supported.bytes.as_unicode(), status=200, headers={
'Content-Type': supported.media_type,
'Content-Type': '%s; charset=utf-8' % supported.media_type,
'Docker-Content-Digest': supported.digest,
})