From b0537fee8e359d0d5dd3ec6d28e3e7c957b4f70d Mon Sep 17 00:00:00 2001 From: "Nasreddin Boulif (bon)" Date: Thu, 12 May 2022 10:44:20 +0000 Subject: [PATCH] [FIX] account_edi: enable to parse XML facturx in mail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: When receiving a mail with a facturx XML file as attachment, the datas in the XML files are not parsed. Cause: For security reason, if a mail attachment is a XML file, it will be saved as plain text and therefore not be parsed. Solution: If attachment mimetype is `plain/text` and content starts with ` --- addons/account_edi/models/account_edi_format.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account_edi/models/account_edi_format.py b/addons/account_edi/models/account_edi_format.py index 189a7082dcf81..253c0795edaee 100644 --- a/addons/account_edi/models/account_edi_format.py +++ b/addons/account_edi/models/account_edi_format.py @@ -437,9 +437,12 @@ def _decode_attachment(self, attachment): content = base64.b64decode(attachment.with_context(bin_size=False).datas) to_process = [] + # XML attachments received by mail have a 'text/plain' mimetype. + # Therefore, if content start with '