Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Walko
funkwhale
Commits
7c473488
Verified
Commit
7c473488
authored
6 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Fix #267: Do not crash when tag contains multiple uuids with a / separator
parent
a16bd2a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/funkwhale_api/music/metadata.py
+16
-3
16 additions, 3 deletions
api/funkwhale_api/music/metadata.py
api/tests/music/test_metadata.py
+14
-0
14 additions, 0 deletions
api/tests/music/test_metadata.py
changes/changelog.d/267.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/267.bugfix
with
31 additions
and
3 deletions
api/funkwhale_api/music/metadata.py
+
16
−
3
View file @
7c473488
...
...
@@ -91,10 +91,23 @@ def convert_track_number(v):
pass
class
FirstUUIDField
(
forms
.
UUIDField
):
def
to_python
(
self
,
value
):
try
:
# sometimes, Picard leaves to uuids in the field, separated
# by a slash
value
=
value
.
split
(
'
/
'
)[
0
]
except
(
AttributeError
,
IndexError
,
TypeError
):
pass
return
super
().
to_python
(
value
)
VALIDATION
=
{
'
musicbrainz_artistid
'
:
forms
.
UUIDField
(),
'
musicbrainz_albumid
'
:
forms
.
UUIDField
(),
'
musicbrainz_recordingid
'
:
forms
.
UUIDField
(),
'
musicbrainz_artistid
'
:
First
UUIDField
(),
'
musicbrainz_albumid
'
:
First
UUIDField
(),
'
musicbrainz_recordingid
'
:
First
UUIDField
(),
}
CONF
=
{
...
...
This diff is collapsed.
Click to expand it.
api/tests/music/test_metadata.py
+
14
−
0
View file @
7c473488
...
...
@@ -95,3 +95,17 @@ def test_can_get_metadata_from_flac_file_not_crash_if_empty():
with
pytest
.
raises
(
metadata
.
TagNotFound
):
data
.
get
(
'
test
'
)
@pytest.mark.parametrize
(
'
field_name
'
,
[
'
musicbrainz_artistid
'
,
'
musicbrainz_albumid
'
,
'
musicbrainz_recordingid
'
,
])
def
test_mbid_clean_keeps_only_first
(
field_name
):
u1
=
str
(
uuid
.
uuid4
())
u2
=
str
(
uuid
.
uuid4
())
field
=
metadata
.
VALIDATION
[
field_name
]
result
=
field
.
to_python
(
'
/
'
.
join
([
u1
,
u2
]))
assert
str
(
result
)
==
u1
This diff is collapsed.
Click to expand it.
changes/changelog.d/267.bugfix
0 → 100644
+
1
−
0
View file @
7c473488
Do not crash when tag contains multiple uuids with a / separator (#267)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment