Commit c47c0718 authored by Elouan Martinet's avatar Elouan Martinet
Browse files

[storages] Always encode/decode in utf-8

parent a8895805869d
......@@ -48,7 +48,7 @@ class S3Storage(Storage):
def callback(self, source, cnx, value):
"""see docstring for prototype, which vary according to is_source_callback
"""
key = source.binary_to_str(value).decode()
key = source.binary_to_str(value).decode('utf-8')
try:
result = self.s3cnx.get_object(Bucket=self.bucket, Key=key)
self.info('Downloaded %s/%s from S3', self.bucket, key)
......@@ -63,7 +63,7 @@ class S3Storage(Storage):
if binary is not None:
key = self.get_s3_key(entity, attr)
# bytes storage used to store S3's object key
binary_obj = Binary(key.encode())
binary_obj = Binary(key.encode('utf-8'))
entity.cw_edited.edited_attribute(attr, binary_obj)
# required workaround for boto3 bug
# https://github.com/boto/s3transfer/issues/80
......@@ -126,7 +126,7 @@ class S3Storage(Storage):
if rset and rset.rows[0][0]:
key = rset.rows[0][0].getvalue()
if PY3:
key = key.decode()
key = key.decode('utf-8')
return key
return self.new_s3_key(entity, attr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment