mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-10-24 03:26:11 -05:00
Fix list out of bounds error in mail message parsing
Check list length before accessing the first two elements of
'dispositions'.
The list may have only a single element ('inline') or may be empty in
mailformed emails.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user