diff --git a/playlist/playlist.go b/playlist/playlist.go index e51dbc16..c3bec6a5 100644 --- a/playlist/playlist.go +++ b/playlist/playlist.go @@ -94,6 +94,10 @@ func (s *Store) Read(relPath string) (*Playlist, error) { return nil, fmt.Errorf("stat m3u: %w", err) } + if stat.IsDir() { + return nil, errors.New("path is a directory") + } + var playlist Playlist playlist.UpdatedAt = stat.ModTime() diff --git a/server/ctrlsubsonic/handlers_playlist.go b/server/ctrlsubsonic/handlers_playlist.go index ca0c6e5c..8426f8af 100644 --- a/server/ctrlsubsonic/handlers_playlist.go +++ b/server/ctrlsubsonic/handlers_playlist.go @@ -75,8 +75,10 @@ func (c *Controller) ServeCreateOrUpdatePlaylist(r *http.Request) *spec.Response playlistPath := playlistIDDecode(playlistID) var playlist playlistp.Playlist - if pl, _ := c.playlistStore.Read(playlistPath); pl != nil { - playlist = *pl + if playlistPath != "" { + if pl, err := c.playlistStore.Read(playlistPath); err != nil && pl != nil { + playlist = *pl + } } if playlist.UserID != 0 && playlist.UserID != user.ID {