From 0e2aae74d259ea0ab0cff7fe56e407ef2acd92aa Mon Sep 17 00:00:00 2001 From: Ro Santalla Date: Wed, 3 Jul 2024 20:57:49 +0200 Subject: [PATCH] fix(playlist): fail early if playlist path is a directory --- playlist/playlist.go | 4 ++++ 1 file changed, 4 insertions(+) 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()