mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06: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
 | 
					                continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            dispositions = content_disposition.strip().split(";")
 | 
					            dispositions = content_disposition.strip().split(";")
 | 
				
			||||||
            if not dispositions[0].lower() == "attachment" and \
 | 
					            if len(dispositions) < 2 or \
 | 
				
			||||||
               "filename" not in dispositions[1].lower():
 | 
					               (not dispositions[0].lower() == "attachment" and
 | 
				
			||||||
 | 
					               "filename" not in dispositions[1].lower()):
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            file_data = part.get_payload()
 | 
					            file_data = part.get_payload()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user