fix(playlists): normalize folder path to forward slashes for PlaylistsPath glob on Windows (#5381)

Signed-off-by: junkerderprovinz <jdp@braethoria.com>
This commit is contained in:
junkerderprovinz 2026-08-09 16:48:13 +02:00
commit 0883a5dcc4
2 changed files with 7 additions and 2 deletions

View file

@ -970,8 +970,9 @@ var _ = Describe("Playlists - Import", func() {
})
It("returns true if folder is in PlaylistsPath", func() {
tests.SkipOnWindows("path separator bug (#TBD-path-sep-playlists)")
conf.Server.PlaylistsPath = "other/**:playlists/**"
// Build the multi-pattern list with the OS path-list separator
// (":" on Unix, ";" on Windows) so InPath splits it correctly.
conf.Server.PlaylistsPath = strings.Join([]string{"other/**", "playlists/**"}, string(filepath.ListSeparator))
Expect(playlists.InPath(folder)).To(BeTrue())
})

View file

@ -73,6 +73,10 @@ func InPath(folder model.Folder) bool {
return true
}
rel, _ := filepath.Rel(folder.LibraryPath, folder.AbsolutePath())
// doublestar globs always use "/" as the separator (and treat "\" as an
// escape), but filepath.Rel returns OS separators, so on Windows the
// back-slashed rel never matches a "foo/**" pattern. Normalize to slashes.
rel = filepath.ToSlash(rel)
for path := range strings.SplitSeq(conf.Server.PlaylistsPath, string(filepath.ListSeparator)) {
if match, _ := doublestar.Match(path, rel); match {
return true