[FIX] mail: better signature detection

This revision back-ports revisions
983d5eb9fa
&
ccbb8e09a6
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
This commit is contained in:
Denis Ledoux 2015-11-30 14:38:51 +01:00
parent d179a94da6
commit 31e8bb8e9d
1 changed files with 1 additions and 1 deletions

View File

@ -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)