[MIG] attachment_minio: for Odoo 14.0

This commit is contained in:
Jared Kipe
2021-03-21 13:19:30 -07:00
parent c7d5170f41
commit a717f9c4bf
3 changed files with 2 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "Attachment MinIO", "name": "Attachment MinIO",
"version": "13.0.1.0.0", "version": "14.0.1.0.0",
"depends": [ "depends": [
"base_attachment_object_storage", "base_attachment_object_storage",
], ],

View File

@@ -3,7 +3,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 io import io
import base64
import logging import logging
from minio import Minio from minio import Minio
from minio.error import NoSuchKey from minio.error import NoSuchKey
@@ -73,7 +72,7 @@ class MinioAttachment(models.Model):
bucket = self._get_minio_bucket(client, name=s3uri.bucket()) bucket = self._get_minio_bucket(client, name=s3uri.bucket())
try: try:
response = client.get_object(bucket, s3uri.item()) response = client.get_object(bucket, s3uri.item())
return base64.b64encode(response.read()) return response.read()
except NoSuchKey: except NoSuchKey:
_logger.info('attachment "%s" missing from remote object storage', (fname, )) _logger.info('attachment "%s" missing from remote object storage', (fname, ))
return '' return ''