]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/bin/parsemail.py
[parser] Accept x-diff patches
[patchwork] / apps / patchwork / bin / parsemail.py
index e2beeae1b752d8ce03d64ee77d839caf294cd09d..d73343a9407fd5a0c36f2af0604f414189f3595c 100755 (executable)
@@ -137,21 +137,13 @@ def find_content(project, mail):
         if part.get_content_maintype() != 'text':
             continue
 
-        #print "\t%s, %s" % \
-        #    (part.get_content_subtype(), part.get_content_charset())
+        payload = part.get_payload(decode=True)
+        subtype = part.get_content_subtype()
 
-        charset = part.get_content_charset()
-        if not charset:
-            charset = mail.get_charset()
-        if not charset:
-            charset = 'utf-8'
-
-        payload = unicode(part.get_payload(decode=True), charset, "replace")
-
-        if part.get_content_subtype() == 'x-patch':
+        if subtype in ['x-patch', 'x-diff']:
             patchbuf = payload
 
-        if part.get_content_subtype() == 'plain':
+        elif subtype == 'plain':
             if not patchbuf:
                 (patchbuf, c) = parse_patch(payload)
             else: