From 5abf2337a9a51ee8b922708e059cfa1ecee48ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Didderen?= Date: Tue, 27 Oct 2026 21:26:36 +0100 Subject: [PATCH] [FIX] account_ebics - Stop camt split on an invalid XML file The error was noted but processing went on with root.nsmap, raising an AttributeError. Unparseable content now also yields the "Invalid XML file." notification instead of an XMLSyntaxError. --- account_ebics/__manifest__.py | 2 +- account_ebics/models/ebics_file.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index 856aadd..8d9ad69 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -5,7 +5,7 @@ "name": "EBICS Banking Protocol", "summary": "Download bank statements and upload payment " "files directly from Odoo, using the European EBICS standard", - "version": "19.0.1.3.2", + "version": "19.0.1.3.3", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index ee67330..1d78492 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -565,10 +565,14 @@ class EbicsFile(models.Model): """ datas = [] file_data = base64.b64decode(self.data) - root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True)) + try: + root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True)) + except etree.XMLSyntaxError: + root = None if root is None: message = self.env._("Invalid XML file.") res["notifications"].append({"type": "error", "message": message}) + return datas ns = {k or "ns": v for k, v in root.nsmap.items()} camt_variant = ns["ns"].split("camt.")[1][:3] variant_tags = {