Skip to content

Commit

Permalink
Fix some incorrect pattern parsing (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala authored May 29, 2024
1 parent 7cb3a61 commit b8a5d50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hsds/util/globparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def globmatch(item, pattern):
asterix_index += 1
glob_right = pattern[asterix_index:]
index = _wildcharmatch(item, glob_left)
if glob_left and index == 0:
if glob_left and index < len(glob_left):
return False
item = item[index:]
if not glob_right:
Expand Down
1 change: 1 addition & 0 deletions tests/unit/glob_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, *args, **kwargs):
def testPatterns(self):

self.assertTrue(globmatch("ab123", "ab*"))
self.assertFalse(globmatch("ab123", "abc*"))
self.assertTrue(globmatch("abc123", "*123"))
self.assertTrue(globmatch("abcxyz", "abc*xyz"))
self.assertTrue(globmatch("abc123xyz", "abc*xyz"))
Expand Down

0 comments on commit b8a5d50

Please sign in to comment.