mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-15 10:13:15 -05:00
Check for and handle the mail's date being naive
This commit is contained in:
parent
4032315851
commit
28b26eb4c7
@ -8,6 +8,8 @@ import requests
|
|||||||
from bleach import clean
|
from bleach import clean
|
||||||
from bleach import linkify
|
from bleach import linkify
|
||||||
from django.conf import settings
|
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 DocumentParser
|
||||||
from documents.parsers import make_thumbnail_from_pdf
|
from documents.parsers import make_thumbnail_from_pdf
|
||||||
from documents.parsers import ParseError
|
from documents.parsers import ParseError
|
||||||
@ -135,7 +137,11 @@ class MailDocumentParser(DocumentParser):
|
|||||||
|
|
||||||
self.text += f"\n\n{strip_text(mail.text)}"
|
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.date = mail.date
|
||||||
|
|
||||||
self.archive_path = self.generate_pdf(document_path)
|
self.archive_path = self.generate_pdf(document_path)
|
||||||
|
|
||||||
def tika_parse(self, html: str):
|
def tika_parse(self, html: str):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user