mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
[FIX] attachment modules: remove base64 encoding when reading files from storage
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
@@ -125,7 +124,7 @@ class IrAttachment(models.Model):
|
|||||||
with io.BytesIO() as res:
|
with io.BytesIO() as res:
|
||||||
bucket.download_fileobj(key, res)
|
bucket.download_fileobj(key, res)
|
||||||
res.seek(0)
|
res.seek(0)
|
||||||
read = base64.b64encode(res.read())
|
read = res.read()
|
||||||
except ClientError:
|
except ClientError:
|
||||||
read = ''
|
read = ''
|
||||||
_logger.info(
|
_logger.info(
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from ..swift_uri import SwiftUri
|
from ..swift_uri import SwiftUri
|
||||||
@@ -132,9 +131,10 @@ class IrAttachment(models.Model):
|
|||||||
)
|
)
|
||||||
return ''
|
return ''
|
||||||
try:
|
try:
|
||||||
resp, obj_content = conn.get_object(swifturi.container(),
|
resp, read = conn.get_object(
|
||||||
swifturi.item())
|
swifturi.container(),
|
||||||
read = base64.b64encode(obj_content)
|
swifturi.item()
|
||||||
|
)
|
||||||
except ClientException:
|
except ClientException:
|
||||||
read = ''
|
read = ''
|
||||||
_logger.exception(
|
_logger.exception(
|
||||||
|
|||||||
Reference in New Issue
Block a user