diff --git a/pkg/wildcard/match.go b/pkg/wildcard/match.go index b0b4acf..b8dd09d 100644 --- a/pkg/wildcard/match.go +++ b/pkg/wildcard/match.go @@ -41,7 +41,7 @@ func match(pattern, name string, simple bool) (matched bool) { return name == pattern } else if idx == len(pattern)-1 && pattern[idx] == '*' { // egg* - return strings.HasPrefix(name, pattern[:idx-1]) + return strings.HasPrefix(name, pattern[:idx]) // egg?bert* } else if wildEnd := pattern[len(pattern)-1] == '*'; !simple && ((wildEnd && strings.Count(pattern, "*") == 1) || (len(pattern) == len(name) && !strings.Contains(pattern, "*"))) { // egg?bert? diff --git a/pkg/wildcard/match_test.go b/pkg/wildcard/match_test.go index 7947856..021a679 100644 --- a/pkg/wildcard/match_test.go +++ b/pkg/wildcard/match_test.go @@ -130,6 +130,11 @@ func TestMatch(t *testing.T) { text: "T?Q", matched: true, }, + { + pattern: "Lee*", + text: "Let Go", + matched: false, + }, { pattern: "*black?metal*", text: " || Artist......: Vredehammer ||\n || Album.......: Mintaka ||\n || Year........: 2013 ||\n || ||\n || Genre.......: black metal ||\n || Label.......: Indie Recordings ||\n || ||\n || Source......: FLAC/WEB (16bit) ||\n || Encoder.....: libFLAC ||\n || Bitrate.....: 948 kbps avg. ||\n || F.Rate......: 44.1kHz ||\n || ||\n || Playtime....: 00:19:27 / 138.70MB ||\n || R.Date......: 2024-10-22 ||\n || S.Date......: 2013-03-27 ||\n || ||\n || ||\n || 01. The King Has Risen 3:53 ||\n || 02. H├╕ster av sjeler 4:17 ||\n || 03. Mintaka 4:10 ||\n || 04. Ditt siste aandedrag 7:07 ||\n || ||\n || ||\n || Vredehammer combines aggressive guitars and Norse melodies. ||\n ",