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:
parent
62609fce3e
commit
eb9ca8e8a8
8 changed files with 120 additions and 11 deletions
|
@ -178,3 +178,22 @@ def test_validate_manifest_known_issue():
|
|||
|
||||
layers = list(manifest.get_layers(None))
|
||||
assert layers[-1].author is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('with_key', [
|
||||
None,
|
||||
docker_v2_signing_key,
|
||||
])
|
||||
def test_validate_manifest_with_emoji(with_key):
|
||||
builder = DockerSchema1ManifestBuilder('somenamespace', 'somerepo', 'sometag')
|
||||
builder.add_layer('sha256:abcde', json.dumps({
|
||||
'id': 'someid',
|
||||
'author': u'😱',
|
||||
}, ensure_ascii=False))
|
||||
|
||||
built = builder.build(with_key, ensure_ascii=False)
|
||||
built._validate()
|
||||
|
||||
# Ensure the manifest can be reloaded.
|
||||
built_bytes = built.bytes.as_encoded_str()
|
||||
DockerSchema1Manifest(Bytes.for_string_or_unicode(built_bytes))
|
||||
|
|
Reference in a new issue