vweb: fix route matching on `/` (#10001)
parent
12c3f85507
commit
8b50a5a171
|
@ -55,6 +55,10 @@ fn test_route_no_match() {
|
|||
url: '/a/b/c/d'
|
||||
route: '/a/b/c'
|
||||
},
|
||||
RoutePair{
|
||||
url: '/a/b/c'
|
||||
route: '/'
|
||||
},
|
||||
]
|
||||
for test in tests {
|
||||
test.test_no_match()
|
||||
|
|
|
@ -443,7 +443,7 @@ fn route_matches(url_words []string, route_words []string) ?[]string {
|
|||
}
|
||||
|
||||
// The last route can end with ... indicating an array
|
||||
if !route_words[route_words.len - 1].ends_with('...') {
|
||||
if route_words.len == 0 || !route_words[route_words.len - 1].ends_with('...') {
|
||||
return none
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue