Skip to content

Commit 4bd0f7a

Browse files
committed
fix(playlist): do not return playlist if user cannot read it
1 parent 3b2345f commit 4bd0f7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

server/ctrlsubsonic/handlers_playlist.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ func (c *Controller) ServeGetPlaylists(r *http.Request) *spec.Response {
4949
}
5050

5151
func (c *Controller) ServeGetPlaylist(r *http.Request) *spec.Response {
52+
user := r.Context().Value(CtxUser).(*db.User)
5253
params := r.Context().Value(CtxParams).(params.Params)
5354
playlistID, err := params.GetFirst("id", "playlistId")
5455
if err != nil {
5556
return spec.NewError(10, "please provide an `id` parameter")
5657
}
5758
playlist, err := c.playlistStore.Read(playlistIDDecode(playlistID))
58-
if err != nil {
59+
if err != nil || !playlist.CanRead(user.ID) {
5960
return spec.NewError(70, "playlist with id %s not found", playlistID)
6061
}
6162
sub := spec.NewResponse()

0 commit comments

Comments
 (0)