mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
remove base64 from base_attachment
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
# Copyright 2017-2019 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# 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 inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -157,7 +156,7 @@ class IrAttachment(models.Model):
|
|||||||
if mimetype.startswith(mimetype_key):
|
if mimetype.startswith(mimetype_key):
|
||||||
if not limit:
|
if not limit:
|
||||||
return True
|
return True
|
||||||
bin_data = base64.b64decode(data) if data else b''
|
bin_data = data
|
||||||
return len(bin_data) <= limit
|
return len(bin_data) <= limit
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -166,7 +165,7 @@ class IrAttachment(models.Model):
|
|||||||
if data and storage in self._get_stores():
|
if data and storage in self._get_stores():
|
||||||
if self._store_in_db_instead_of_object_storage(data, mimetype):
|
if self._store_in_db_instead_of_object_storage(data, mimetype):
|
||||||
# compute the fields that depend on datas
|
# compute the fields that depend on datas
|
||||||
bin_data = base64.b64decode(data) if data else b''
|
bin_data = data
|
||||||
values = {
|
values = {
|
||||||
'file_size': len(bin_data),
|
'file_size': len(bin_data),
|
||||||
'checksum': self._compute_checksum(bin_data),
|
'checksum': self._compute_checksum(bin_data),
|
||||||
|
|||||||
Reference in New Issue
Block a user