mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-28 03:46:06 -05:00 
			
		
		
		
	Check for and handle the mail's date being naive
This commit is contained in:
		 Trenton Holmes
					Trenton Holmes
				
			
				
					committed by
					
						 Trenton H
						Trenton H
					
				
			
			
				
	
			
			
			 Trenton H
						Trenton H
					
				
			
						parent
						
							4032315851
						
					
				
				
					commit
					28b26eb4c7
				
			| @@ -8,6 +8,8 @@ import requests | ||||
| from bleach import clean | ||||
| from bleach import linkify | ||||
| from django.conf import settings | ||||
| from django.utils.timezone import is_naive | ||||
| from django.utils.timezone import make_aware | ||||
| from documents.parsers import DocumentParser | ||||
| from documents.parsers import make_thumbnail_from_pdf | ||||
| from documents.parsers import ParseError | ||||
| @@ -135,7 +137,11 @@ class MailDocumentParser(DocumentParser): | ||||
|  | ||||
|         self.text += f"\n\n{strip_text(mail.text)}" | ||||
|  | ||||
|         if is_naive(mail.date): | ||||
|             self.date = make_aware(mail.date) | ||||
|         else: | ||||
|             self.date = mail.date | ||||
|  | ||||
|         self.archive_path = self.generate_pdf(document_path) | ||||
|  | ||||
|     def tika_parse(self, html: str): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user