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:
@@ -54,8 +54,9 @@ func Lookup(dbc *db.DB, musicPaths []string, podcastsPath string, path string) (
|
|||||||
|
|
||||||
var musicPath string
|
var musicPath string
|
||||||
for _, mp := range musicPaths {
|
for _, mp := range musicPaths {
|
||||||
if strings.HasPrefix(path, mp) {
|
if strings.HasPrefix(path, filepath.Clean(mp)+string(filepath.Separator) /* ensure trailing */) {
|
||||||
musicPath = mp
|
musicPath = mp
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if musicPath == "" {
|
if musicPath == "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user