From 60fb31e29f067c9c9fa4e5236e633ecdd868a5b5 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 20 Jun 2017 15:09:28 +0200 Subject: [PATCH] [FIX] ignore files with unknown mimetype --- document_ocr/models/ir_attachment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document_ocr/models/ir_attachment.py b/document_ocr/models/ir_attachment.py index 7a69a718970..1dfb7231556 100644 --- a/document_ocr/models/ir_attachment.py +++ b/document_ocr/models/ir_attachment.py @@ -18,7 +18,7 @@ class IrAttachment(models.Model): def _index(self, data, datas_fname, file_type): mimetype, content = super(IrAttachment, self)._index( data, datas_fname, file_type) - if not content or content == 'image': + if mimetype and (not content or content == 'image'): has_synchr_param = self.env['ir.config_parameter'].get_param( 'document_ocr.synchronous', 'False') == 'True' has_force_flag = self.env.context.get('document_ocr_force')