From ed92ada4ea45fde05022d4f80b36bd4334b9094c Mon Sep 17 00:00:00 2001 From: Don Kendall Date: Wed, 4 Nov 2020 09:39:06 -0500 Subject: [PATCH] remove base64 from base_attachment --- base_attachment_object_storage/models/ir_attachment.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base_attachment_object_storage/models/ir_attachment.py b/base_attachment_object_storage/models/ir_attachment.py index cd26db6..1a27331 100644 --- a/base_attachment_object_storage/models/ir_attachment.py +++ b/base_attachment_object_storage/models/ir_attachment.py @@ -1,7 +1,6 @@ # Copyright 2017-2019 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -import base64 import inspect import logging import os @@ -157,7 +156,7 @@ class IrAttachment(models.Model): if mimetype.startswith(mimetype_key): if not limit: return True - bin_data = base64.b64decode(data) if data else b'' + bin_data = data return len(bin_data) <= limit return False @@ -166,7 +165,7 @@ class IrAttachment(models.Model): if data and storage in self._get_stores(): if self._store_in_db_instead_of_object_storage(data, mimetype): # compute the fields that depend on datas - bin_data = base64.b64decode(data) if data else b'' + bin_data = data values = { 'file_size': len(bin_data), 'checksum': self._compute_checksum(bin_data),