Skip to content

Commit

Permalink
Allow for exposing of same path without "/" if already exposed using …
Browse files Browse the repository at this point in the history
…wildcard (#1621) (#1625)

* Allow for exposing of same path without "/" if already exposed using wildcard

* Update segment_trie_test.go
  • Loading branch information
barchw authored Jan 21, 2025
1 parent 30f2831 commit 27bba08
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/path/segment_trie/segment_trie.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ func findExistingPath(node *Node, tokens []token.Token, cur int) bool {
}
}
case token.BracedDoubleAsterix:
if node.EndNode {
return false
}
bracedAsterixSuffix := tokens[cur+1:]
return suffixExist(node, bracedAsterixSuffix, 0)
}
Expand Down
16 changes: 16 additions & 0 deletions internal/path/segment_trie/segment_trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ var _ = Describe("SegmentTrie", func() {
Entry("No conflict: prefix and double asterisk", []string{
"/abc/{**}",
}, 0),
Entry("No conflict: path without / at end and same path with double asterisk", []string{
"/abc",
"/abc/{**}",
}, 0),
Entry("No conflict: path without / at end and same path with single asterisk", []string{
"/abc",
"/abc/{*}",
}, 0),
Entry("Conflict: path with / at end and same path with single asterisk", []string{
"/abc/",
"/abc/{*}",
}, 1),
Entry("Conflict: path with / at end and same path with double asterisk", []string{
"/abc/",
"/abc/{**}",
}, 1),
Entry("Conflict: exact with single asterisk", []string{
"/abc/def/ghi",
"/abc/{*}/ghi",
Expand Down

0 comments on commit 27bba08

Please sign in to comment.