summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNans Lefebvre <len@odoo.com>2019-10-01 14:30:38 +0000
committerfw-bot <otis@odoo.com>2019-10-10 14:28:09 +0000
commit66a2ca059193272215519459e6660c39ec28e2be (patch)
treea56f43b74fdc4f21ca05e279e12e8ab3406c750a /addons
parent381fa5abdd83384b630d4e6326a06b58c422e920 (diff)
[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
Diffstat (limited to 'addons')
-rw-r--r--addons/account_facturx/models/account_move.py6
1 files changed, 0 insertions, 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: