fix(wildcard): improve short word matching (#1806)

fix(wildcard): improve short word matching
This commit is contained in:
Kyle Sanderson 2024-11-06 04:06:27 -08:00 committed by GitHub
parent 1e76f33e47
commit 594393eaaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -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?