]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
parsemail: ignore html part of multi-part comments
authorYuri Volchkov <yuri.volchkov@gmail.com>
Wed, 20 Jun 2018 12:21:42 +0000 (14:21 +0200)
committerStephen Finucane <stephen@that.guru>
Sun, 24 Jun 2018 19:41:34 +0000 (20:41 +0100)
Currently an html-protection present only for patch-emails. If a
multi-part comment-email arrives, it messes up patchwork. In my case,
the symptom was a non intended 'Signed-off-by' in the downloaded
patches, with html-like junk.

This patch makes parsemail skip all parts of comment which are not
text/plain.

Of course, this will drop html-only emails completely. But they can
not be parsed anyways.

Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
Reviewed-by: Stephen Finucane <stephen@that.guru>
(cherry picked from commit e27ff061dc01e51967a978884a5c59152863ab9c)

patchwork/parser.py

index 8f9af81163f93661c209e4636cf77c09b444315b..a40f9314a8252d0f56663adb1c2397f38a089831 100644 (file)
@@ -576,10 +576,13 @@ def find_comment_content(mail):
     """Extract content from a mail."""
     commentbuf = ''
 
-    for payload, _ in _find_content(mail):
+    for payload, subtype in _find_content(mail):
         if not payload:
             continue
 
+        if subtype != 'plain':
+            continue
+
         commentbuf += payload.strip() + '\n'
 
     commentbuf = clean_content(commentbuf)