Merge pull request #213 from p-tombez/fix_base64

[FIX] attachment modules: remove base64 encoding when reading files from storage
This commit is contained in:
Patrick Tombez authored and GitHub committed 2020-11-04 10:46:45 +01:00
commit 40f46317df
2 files changed
+5 -6

No files matched your search

+1 -2
View File
@@ -2,7 +2,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import base64
import logging
import os
import io
@@ -125,7 +124,7 @@ class IrAttachment(models.Model):
with io.BytesIO() as res:
bucket.download_fileobj(key, res)
res.seek(0)
read = base64.b64encode(res.read())
read = res.read()
except ClientError:
read = ''
_logger.info(
+4 -4
View File
@@ -2,7 +2,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import base64
import logging
import os
from ..swift_uri import SwiftUri
@@ -132,9 +131,10 @@ class IrAttachment(models.Model):
)
return ''
try:
resp, obj_content = conn.get_object(swifturi.container(),
swifturi.item())
read = base64.b64encode(obj_content)
resp, read = conn.get_object(
swifturi.container(),
swifturi.item()
)
except ClientException:
read = ''
_logger.exception(
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.