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-22 01:11:08 +00:00
committed by GitHub
co-authored by sentriz
parent f34cd2e213
commit e63ee9687e
@@ -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 == "" {