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
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
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
Arthur Brugière
funkwhale
Commits
19211276
Unverified
Commit
19211276
authored
4 years ago
by
Agate
💬
Browse files
Options
Downloads
Patches
Plain Diff
Fix #1158: crash when loading recent albums via Subsonic
parent
b637a94e
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/subsonic/views.py
+1
-3
1 addition, 3 deletions
api/funkwhale_api/subsonic/views.py
api/tests/subsonic/test_views.py
+15
-0
15 additions, 0 deletions
api/tests/subsonic/test_views.py
changes/changelog.d/1158.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/1158.bugfix
with
17 additions
and
3 deletions
api/funkwhale_api/subsonic/views.py
+
1
−
3
View file @
19211276
...
...
@@ -458,9 +458,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
elif
type
==
"
alphabeticalByName
"
or
not
type
:
queryset
=
queryset
.
order_by
(
"
artist__title
"
)
elif
type
==
"
recent
"
or
not
type
:
queryset
=
queryset
.
exclude
(
release_date__in
=
[
""
,
None
]).
order_by
(
"
-release_date
"
)
queryset
=
queryset
.
exclude
(
release_date
=
None
).
order_by
(
"
-release_date
"
)
elif
type
==
"
newest
"
or
not
type
:
queryset
=
queryset
.
order_by
(
"
-creation_date
"
)
elif
type
==
"
byGenre
"
and
data
.
get
(
"
genre
"
):
...
...
This diff is collapsed.
Click to expand it.
api/tests/subsonic/test_views.py
+
15
−
0
View file @
19211276
...
...
@@ -435,6 +435,21 @@ def test_get_album_list2(
playable_by
.
assert_called_once
()
def
test_get_album_list2_recent
(
db
,
logged_in_api_client
,
factories
):
url
=
reverse
(
"
api:subsonic-get_album_list2
"
)
assert
url
.
endswith
(
"
getAlbumList2
"
)
is
True
factories
[
"
music.Album
"
](
playable
=
True
,
release_date
=
None
)
album2
=
factories
[
"
music.Album
"
](
playable
=
True
)
album3
=
factories
[
"
music.Album
"
](
playable
=
True
)
response
=
logged_in_api_client
.
get
(
url
,
{
"
f
"
:
"
json
"
,
"
type
"
:
"
recent
"
})
assert
response
.
status_code
==
200
expected_albums
=
reversed
(
sorted
([
album3
,
album2
],
key
=
lambda
a
:
a
.
release_date
))
assert
response
.
data
==
{
"
albumList2
"
:
{
"
album
"
:
serializers
.
get_album_list2_data
(
expected_albums
)}
}
@pytest.mark.parametrize
(
"
f
"
,
[
"
json
"
])
def
test_get_album_list2_pagination
(
f
,
db
,
logged_in_api_client
,
factories
):
url
=
reverse
(
"
api:subsonic-get_album_list2
"
)
...
...
This diff is collapsed.
Click to expand it.
changes/changelog.d/1158.bugfix
0 → 100644
+
1
−
0
View file @
19211276
Fixed crash when loading recent albums via Subsonic (#1158)
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