Skip to content
Snippets Groups Projects
Verified Commit 4dcdc939 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #966: More robust importer against malformed dates

parent 4e8278fb
No related branches found
No related tags found
No related merge requests found
......@@ -556,7 +556,7 @@ class PermissiveDateField(serializers.CharField):
try:
parsed = pendulum.parse(str(value))
return datetime.date(parsed.year, parsed.month, parsed.day)
except pendulum.exceptions.ParserError:
except (pendulum.exceptions.ParserError, ValueError):
pass
return None
......
......@@ -239,6 +239,7 @@ def test_can_get_metadata_from_flac_file_not_crash_if_empty():
("2017-12-31", datetime.date(2017, 12, 31)),
("2017-14-01 01:32", datetime.date(2017, 1, 14)), # deezer format
("2017-02", datetime.date(2017, 1, 1)), # weird format that exists
("0000", None),
("nonsense", None),
],
)
......
More robust importer against malformed dates (#966)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment