Skip to content

Commit

Permalink
fix(specid): match music dirs with trailing slash (#439)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jmbannon and sentriz committed Dec 22, 2023
1 parent f34cd2e commit e63ee96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/ctrlsubsonic/specidpaths/specidpaths.go
Expand Up @@ -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 == "" {
Expand Down

0 comments on commit e63ee96

Please sign in to comment.