[MOV] tools: put _neuter_mimetype from Document app

This method will be used later in other module(s) than Document.

Task : 1960733
This commit is contained in:
William Henrotin
2020-03-04 10:12:04 +00:00
committed by svs-odoo
parent 024010bbe1
commit a56a4f8aee
+6
View File
@@ -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