diff --git a/src/documents/mail.py b/src/documents/mail.py index f1a84d8e0..1be62527d 100644 --- a/src/documents/mail.py +++ b/src/documents/mail.py @@ -75,8 +75,9 @@ class Message(Loggable): continue dispositions = content_disposition.strip().split(";") - if not dispositions[0].lower() == "attachment" and \ - "filename" not in dispositions[1].lower(): + if len(dispositions) < 2 or \ + (not dispositions[0].lower() == "attachment" and + "filename" not in dispositions[1].lower()): continue file_data = part.get_payload()