mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-18 07:30:29 +00:00
Merge 5edfe5736c73725baa29adf0d08a97de136cd492 into dbd26ba2e71d0a5b79dba873a2beeff59f1cd8dd
This commit is contained in:
commit
58541b5509
@ -1109,8 +1109,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())
|
||||
})
|
||||
|
||||
|
||||
@ -74,6 +74,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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user