From 31e8bb8e9d52735d9619a715858c33439ec372f0 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 30 Nov 2015 14:38:51 +0100 Subject: [PATCH] [FIX] mail: better signature detection This revision back-ports revisions 983d5eb9fa0f3f98b1989906d9e3ba5fe59d13a1 & ccbb8e09a6ac38d149969cc7e78bfe0512920174 regarding this signature regex. Besides, it adds the fact the dashes have to be at the beginning of the line to make them detected as a signature. opw-655834 --- openerp/tools/mail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index b0212db11ae..25db7a1a28b 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -140,7 +140,7 @@ def html_email_clean(html): node.getparent().remove(node) # 4. strip signatures - signature = re.compile(r'([-]{2}[\s]?[\r\n]{1,2}[^\z]+)') + signature = re.compile(r'(^[-]{2,}[\s]?[\r\n]{1,2}[\s\S]+)', re.M) for elem in root.getiterator(): if elem.text: match = re.search(signature, elem.text)