mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-07 23:35:22 +01:00
fixes #25
This commit is contained in:
parent
b787983e42
commit
5894060dc5
1 changed files with 2 additions and 4 deletions
|
|
@ -163,8 +163,6 @@ def parse_date(filename, text):
|
|||
|
||||
date = None
|
||||
|
||||
next_year = timezone.now().year + 5 # Arbitrary 5 year future limit
|
||||
|
||||
# if filename date parsing is enabled, search there first:
|
||||
if settings.FILENAME_DATE_ORDER:
|
||||
for m in re.finditer(DATE_REGEX, filename):
|
||||
|
|
@ -176,7 +174,7 @@ def parse_date(filename, text):
|
|||
# Skip all matches that do not parse to a proper date
|
||||
continue
|
||||
|
||||
if date is not None and next_year > date.year > 1900:
|
||||
if date and date.year > 1900 and date <= timezone.now():
|
||||
return date
|
||||
|
||||
# Iterate through all regex matches in text and try to parse the date
|
||||
|
|
@ -189,7 +187,7 @@ def parse_date(filename, text):
|
|||
# Skip all matches that do not parse to a proper date
|
||||
continue
|
||||
|
||||
if date is not None and next_year > date.year > 1900:
|
||||
if date and date.year > 1900 and date <= timezone.now():
|
||||
break
|
||||
else:
|
||||
date = None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue