mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 10:28:40 -06:00
[IMP] apply file directly to local file if storage is 'file'
This commit is contained in:
parent
47f0eafe9a
commit
6b74ea45e1
@ -61,8 +61,13 @@ class IrAttachment(Model):
|
|||||||
hasattr(magic, 'MAGIC_MIME_TYPE') and
|
hasattr(magic, 'MAGIC_MIME_TYPE') and
|
||||||
magic.MAGIC_MIME_TYPE or magic.MAGIC_MIME)
|
magic.MAGIC_MIME_TYPE or magic.MAGIC_MIME)
|
||||||
ms.load()
|
ms.load()
|
||||||
mimetype = ms.buffer(
|
if model == self._name and binary_field == 'datas'\
|
||||||
base64.b64decode(this[binary_field]))
|
and this.store_fname:
|
||||||
|
mimetype = ms.file(
|
||||||
|
this._full_path(cr, uid, this.store_fname))
|
||||||
|
else:
|
||||||
|
mimetype = ms.buffer(
|
||||||
|
base64.b64decode(this[binary_field]))
|
||||||
except ImportError:
|
except ImportError:
|
||||||
(mimetype, encoding) = mimetypes.guess_type(
|
(mimetype, encoding) = mimetypes.guess_type(
|
||||||
'data:;base64,' + this[binary_field], strict=False)
|
'data:;base64,' + this[binary_field], strict=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user