From e63ee9687e1cb4b76faa9ffe10bf99b4640ddd43 Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 21 Dec 2023 17:11:08 -0800 Subject: [PATCH] fix(specid): match music dirs with trailing slash (#439) * Fix bug with checking path prefixes * slash instead * double quote * lint * lint again * ensure trailing slash when substring matching --------- Co-authored-by: sentriz --- server/ctrlsubsonic/specidpaths/specidpaths.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/ctrlsubsonic/specidpaths/specidpaths.go b/server/ctrlsubsonic/specidpaths/specidpaths.go index c054ee12..f39bd3d0 100644 --- a/server/ctrlsubsonic/specidpaths/specidpaths.go +++ b/server/ctrlsubsonic/specidpaths/specidpaths.go @@ -54,8 +54,9 @@ func Lookup(dbc *db.DB, musicPaths []string, podcastsPath string, path string) ( var musicPath string for _, mp := range musicPaths { - if strings.HasPrefix(path, mp) { + if strings.HasPrefix(path, filepath.Clean(mp)+string(filepath.Separator) /* ensure trailing */) { musicPath = mp + break } } if musicPath == "" {