Skip to content

Commit

Permalink
fix(playlist): do not return playlist if user cannot read it
Browse files Browse the repository at this point in the history
  • Loading branch information
nadiamoe committed Jul 3, 2024
1 parent 3b2345f commit 4bd0f7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/ctrlsubsonic/handlers_playlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ func (c *Controller) ServeGetPlaylists(r *http.Request) *spec.Response {
}

func (c *Controller) ServeGetPlaylist(r *http.Request) *spec.Response {
user := r.Context().Value(CtxUser).(*db.User)
params := r.Context().Value(CtxParams).(params.Params)
playlistID, err := params.GetFirst("id", "playlistId")
if err != nil {
return spec.NewError(10, "please provide an `id` parameter")
}
playlist, err := c.playlistStore.Read(playlistIDDecode(playlistID))
if err != nil {
if err != nil || !playlist.CanRead(user.ID) {
return spec.NewError(70, "playlist with id %s not found", playlistID)
}
sub := spec.NewResponse()
Expand Down

0 comments on commit 4bd0f7a

Please sign in to comment.