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

[storages] Refactor upload code

parent b32b817810c1
......@@ -62,10 +62,11 @@ class S3Storage(Storage):
binary = entity.cw_edited.pop(attr)
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('utf-8'))
entity.cw_edited.edited_attribute(attr, binary_obj)
# required workaround for boto3 bug
# save S3 key
entity.cw_edited.edited_attribute(
attr, Binary(key.encode('utf-8')))
# copy Binary value, workaround for boto3 bug
# https://github.com/boto/s3transfer/issues/80
# .read() is required since Binary can't wrap itself
buffer = Binary(binary.read())
......
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