Avoid taking message content from something that looks like an attachment
authorMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2012 20:08:22 +0000 (22:08 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 20 Jun 2012 20:08:22 +0000 (22:08 +0200)
loader/lib/parser.py

index a8f8920f323a012899ef58170b29834c2de0c494..dd8d215b4de107ec5785188c5458743043fabfcf 100644 (file)
@@ -100,6 +100,9 @@ class ArchivesParser(object):
                                print "Found multipart/mixed in message '%s', but no MIME type on part. Trying text/plain." % self.msgid
                                return self.get_payload_as_unicode(p)
                        if p.get_params()[0][0].lower() == 'text/plain':
+                               # Don't include it if it looks like an attachment
+                               if p.has_key('Content-Disposition') and p['Content-Disposition'].startswith('attachment'):
+                                       continue
                                return self.get_payload_as_unicode(p)
                        if p.is_multipart():
                                b = self.recursive_first_plaintext(p)