mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
fixes #25
This commit is contained in:
parent
b787983e42
commit
5894060dc5
@ -163,8 +163,6 @@ def parse_date(filename, text):
|
|||||||
|
|
||||||
date = None
|
date = None
|
||||||
|
|
||||||
next_year = timezone.now().year + 5 # Arbitrary 5 year future limit
|
|
||||||
|
|
||||||
# if filename date parsing is enabled, search there first:
|
# if filename date parsing is enabled, search there first:
|
||||||
if settings.FILENAME_DATE_ORDER:
|
if settings.FILENAME_DATE_ORDER:
|
||||||
for m in re.finditer(DATE_REGEX, filename):
|
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
|
# Skip all matches that do not parse to a proper date
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if date is not None and next_year > date.year > 1900:
|
if date and date.year > 1900 and date <= timezone.now():
|
||||||
return date
|
return date
|
||||||
|
|
||||||
# Iterate through all regex matches in text and try to parse the 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
|
# Skip all matches that do not parse to a proper date
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if date is not None and next_year > date.year > 1900:
|
if date and date.year > 1900 and date <= timezone.now():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
date = None
|
date = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user