Skip to content

Commit

Permalink
[fix #40] 🐛 filename starting with unicode doesn't match *
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatcuk committed May 31, 2020
1 parent 1a01b95 commit bcc22aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions doublestar.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ func matchComponent(pattern, name string) ([]string, error) {
if m, e := matchComponent(pattern[patIdx:], name[nameIdx:]); m != nil || e != nil {
return m, e
}
_, nameAdj = utf8.DecodeRuneInString(name[nameIdx:])
}
return nil, nil
} else if patRune == '[' {
Expand Down
3 changes: 3 additions & 0 deletions doublestar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ var matchTests = []MatchTest{
{"abc/**", "abc/b", true, nil, true},
{"**/abc", "abc", true, nil, true},
{"abc**", "abc/b", false, nil, true},
{"**/*.txt", "abc/【test】.txt", true, nil, true},
{"**/【*", "abc/【test】.txt", true, nil, true},
{"broken-symlink", "broken-symlink", true, nil, !onWindows},
{"working-symlink/c/*", "working-symlink/c/d", true, nil, !onWindows},
{"working-sym*/*", "working-symlink/c", true, nil, !onWindows},
Expand Down Expand Up @@ -362,6 +364,7 @@ func TestMain(m *testing.M) {
touch("test", "xxx")
touch("test", "z")
touch("test", "α")
touch("test", "abc", "【test】.txt")

if !onWindows {
// these files/symlinks won't work on Windows
Expand Down

0 comments on commit bcc22aa

Please sign in to comment.