mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Ensure dates from emails are made timezone aware if not already
This commit is contained in:
parent
55295922c8
commit
db02d5eff0
@ -19,6 +19,8 @@ from celery import shared_task
|
|||||||
from celery.canvas import Signature
|
from celery.canvas import Signature
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import DatabaseError
|
from django.db import DatabaseError
|
||||||
|
from django.utils.timezone import is_naive
|
||||||
|
from django.utils.timezone import make_aware
|
||||||
from documents.loggers import LoggingMixin
|
from documents.loggers import LoggingMixin
|
||||||
from documents.models import Correspondent
|
from documents.models import Correspondent
|
||||||
from documents.parsers import is_mime_type_supported
|
from documents.parsers import is_mime_type_supported
|
||||||
@ -236,6 +238,10 @@ def apply_mail_action(
|
|||||||
rule = MailRule.objects.get(pk=rule_id)
|
rule = MailRule.objects.get(pk=rule_id)
|
||||||
account = MailAccount.objects.get(pk=rule.account.pk)
|
account = MailAccount.objects.get(pk=rule.account.pk)
|
||||||
|
|
||||||
|
# Ensure the date is properly timezone aware
|
||||||
|
if is_naive(message_date):
|
||||||
|
message_date = make_aware(message_date)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
action = get_rule_action(rule)
|
action = get_rule_action(rule)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import email.contentmanager
|
import email.contentmanager
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
import uuid
|
import uuid
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
Loading…
x
Reference in New Issue
Block a user