diff --git a/doublestar.go b/doublestar.go index 466b140..3ea0606 100644 --- a/doublestar.go +++ b/doublestar.go @@ -327,7 +327,7 @@ func matchComponent(pattern, name string) (bool, error) { } } if patIdx >= patternLen && nameIdx >= nameLen { return true, nil } - if nameIdx >= nameLen && pattern[patIdx:] == "*" { return true, nil } + if nameIdx >= nameLen && pattern[patIdx:] == "*" || pattern[patIdx:] == "**" { return true, nil } return false, nil } diff --git a/doublestar_test.go b/doublestar_test.go index dba92b6..2482ff8 100644 --- a/doublestar_test.go +++ b/doublestar_test.go @@ -81,6 +81,8 @@ var matchTests = []MatchTest{ {"ab{c,d}", "abc", true, nil, true}, {"ab{c,d,*}", "abcde", true, nil, true}, {"ab{c,d}[", "abcd", false, ErrBadPattern, true}, + {"abc**", "abc", true, nil, true}, + {"**abc", "abc", true, nil, true}, } func TestMatch(t *testing.T) {