Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dpath/segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def match(segments: Path, glob: Glob):

match(segments, glob) -> bool
"""
# Handle edge case where last segment of the glob is a wildcard and we want fnmatchcase to validate the path.
if len(segments) == len(glob) - 1 and glob.count("*") > 0 and glob.index("*") == len(glob) - 1:
segments = list(segments) + [""]

segments = tuple(segments)
glob = tuple(glob)

Expand Down
1 change: 0 additions & 1 deletion tests/test_broken_afilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def filter(x):
],
}

results = [[x[0], x[1]] for x in dpath.search(a, 'actions/*', yielded=True)]
results = [[x[0], x[1]] for x in dpath.search(a, 'actions/*', afilter=filter, yielded=True)]
assert len(results) == 1
assert results[0][1]['type'] == 'correct'