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 <senan@senan.xyz>
This commit is contained in:
Jesse Bannon
2023-12-21 17:11:08 -08:00
committed by GitHub
parent f34cd2e213
commit e63ee9687e

View File

@@ -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 == "" {