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
5 changes: 5 additions & 0 deletions node/path_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ func (e *PathMatchExpression) match(segs segments, base *Path, candidate *Path)

// we keep peeling back slice as long as it continues to match candidate as we
// peel that back as well.
if j < i {
// segments path is longer than candidate, we need to traverse segments to only verify common part
i--
continue
}
if j == i {
if p.Meta.Ident() != segs[i] {
return false
Expand Down
5 changes: 5 additions & 0 deletions node/path_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,9 @@ module m {

p4, _ := parseUrlPath("ddd/eee", module)
fc.AssertEqual(t, false, expr.PathMatches(p4[0].Parent, p4[len(p4)-1]))

// Match parent when path targets child nodes
expr2, err := ParsePathExpression("aaa/bbb/ccc")
fc.AssertEqual(t, nil, err)
fc.AssertEqual(t, true, expr2.PathMatches(p1[0].Parent, p1[len(p1)-1]))
}