[13.0][FIX] attachment_azure: in 13.0, _file_read() is expected to return base64 encoded data

This commit is contained in:
Nils Hamerlinck
2021-11-09 19:04:21 +07:00
parent 94609a0ddc
commit ead50c44f1
+2 -1
View File
@@ -1,6 +1,7 @@
# Copyright 2016-2021 Camptocamp SA # Copyright 2016-2021 Camptocamp SA
# Copyright 2021 Open Source Integrators # Copyright 2021 Open Source Integrators
# 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 io import io
import logging import logging
import os import os
@@ -149,7 +150,7 @@ class IrAttachment(models.Model):
key = fname.replace("azure://", "", 1).lower() key = fname.replace("azure://", "", 1).lower()
try: try:
blob_client = container_client.get_blob_client(key) blob_client = container_client.get_blob_client(key)
read = blob_client.download_blob().readall() read = base64.b64encode(blob_client.download_blob().readall())
except HttpResponseError: except HttpResponseError:
read = "" read = ""
_logger.info("Attachment '%s' missing on object storage", fname) _logger.info("Attachment '%s' missing on object storage", fname)