Make sure to decode manifests into utf-8 when necessary
This fixes a decoding error
This commit is contained in:
parent
6cc7102ec8
commit
48e584905a
15 changed files with 268 additions and 32 deletions
|
|
@ -102,6 +102,7 @@ from dateutil.parser import parse as parse_date
|
|||
|
||||
from digest import digest_tools
|
||||
from image.docker import ManifestException
|
||||
from image.docker.schemautil import ensure_utf8
|
||||
|
||||
|
||||
DOCKER_SCHEMA2_CONFIG_HISTORY_KEY = "history"
|
||||
|
|
@ -185,7 +186,7 @@ class DockerSchema2Config(object):
|
|||
self._config_bytes = config_bytes
|
||||
|
||||
try:
|
||||
self._parsed = json.loads(config_bytes)
|
||||
self._parsed = json.loads(ensure_utf8(config_bytes))
|
||||
except ValueError as ve:
|
||||
raise MalformedSchema2Config('malformed config data: %s' % ve)
|
||||
|
||||
|
|
@ -197,12 +198,12 @@ class DockerSchema2Config(object):
|
|||
@property
|
||||
def digest(self):
|
||||
""" Returns the digest of this config object. """
|
||||
return digest_tools.sha256_digest(self._config_bytes)
|
||||
return digest_tools.sha256_digest(ensure_utf8(self._config_bytes))
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
""" Returns the size of this config object. """
|
||||
return len(self._config_bytes)
|
||||
return len(ensure_utf8(self._config_bytes))
|
||||
|
||||
@property
|
||||
def bytes(self):
|
||||
|
|
|
|||
Reference in a new issue