From 66a2ca059193272215519459e6660c39ec28e2be Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Tue, 1 Oct 2019 14:30:38 +0000 Subject: [PATCH] [FIX] account_facturx: process pdf with .PDF extensions In fact, "not filename.endswith('.pdf')" does not "Check if the attachment is a pdf". Some pdf files have filenames with a pdf extension, but .PDF, .Pdf work generally just as well, and it's also possible to live without a file extension. In any case, it doesn't prevent from crashes because of corrupted files, or files that are not pdf files but have the extension. opw 2075933 X-original-commit: 3f63447d8f25f6ff8a4d9951a74db069d41332f3 --- addons/account_facturx/models/account_move.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/account_facturx/models/account_move.py b/addons/account_facturx/models/account_move.py index 81c2d67d403..1808bc6d62e 100644 --- a/addons/account_facturx/models/account_move.py +++ b/addons/account_facturx/models/account_move.py @@ -254,12 +254,6 @@ class AccountMove(models.Model): def _get_attachment_content(attachment): # Handle both _Attachment namedtuple in mail.thread or ir.attachment. return hasattr(attachment, 'content') and getattr(attachment, 'content') or base64.b64decode(attachment.datas) - filename = _get_attachment_filename(attachment) - - # Check if the attachment is a pdf. - if not filename.endswith('.pdf'): - return - content = _get_attachment_content(attachment) with io.BytesIO(content) as buffer: