Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Georg Abenthung
funkwhale
Commits
4dcdc939
Verified
Commit
4dcdc939
authored
Nov 14, 2019
by
Eliot Berriot
Browse files
Fix #966: More robust importer against malformed dates
parent
4e8278fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/music/metadata.py
View file @
4dcdc939
...
...
@@ -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
...
...
api/tests/music/test_metadata.py
View file @
4dcdc939
...
...
@@ -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
),
],
)
...
...
changes/changelog.d/966.bugfix
0 → 100644
View file @
4dcdc939
More robust importer against malformed dates (#966)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment