diff options
| author | William Henrotin <whe@odoo.com> | 2020-03-03 09:41:57 +0000 |
|---|---|---|
| committer | svs-odoo <svs@odoo.com> | 2020-03-04 10:12:04 +0000 |
| commit | a56a4f8aeeebf946745b09b0b1a649293b806546 (patch) | |
| tree | 83b93d9e8186cf7208e48513c4e2d7668fca567e /odoo | |
| parent | 024010bbe17242537c691fb7f12db8655db8fe87 (diff) | |
[MOV] tools: put _neuter_mimetype from Document app
This method will be used later in other module(s) than Document.
Task : 1960733
Diffstat (limited to 'odoo')
| -rw-r--r-- | odoo/tools/mimetypes.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/tools/mimetypes.py b/odoo/tools/mimetypes.py index 79bced25c5d..93f32681e8e 100644 --- a/odoo/tools/mimetypes.py +++ b/odoo/tools/mimetypes.py @@ -177,3 +177,9 @@ else: ms = magic.open(magic.MAGIC_MIME_TYPE) ms.load() guess_mimetype = lambda bin_data, default=None: ms.buffer(bin_data) + +def neuter_mimetype(mimetype, user): + wrong_type = 'ht' in mimetype or 'xml' in mimetype or 'svg' in mimetype + if wrong_type and not user._is_system(): + return 'text/plain' + return mimetype |
