File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -425,16 +425,25 @@ func matchTree(
425425 pathIndex = path.len
426426 of ptrnParam:
427427 if node.isGreedy:
428- ctx.request.pathParams[node.value] = path[pathIndex .. ^ 1 ]
428+ if pathIndex < path.len:
429+ ctx.request.pathParams[node.value] = path[pathIndex .. ^ 1 ]
430+ else :
431+ ctx.request.pathParams[node.value] = " "
429432 pathIndex = path.len
430433 else :
431434 let newPathIndex = path.find (pathSeparator,
432435 pathIndex) # skip forward to the next separator
433436 if newPathIndex == - 1 :
434- ctx.request.pathParams[node.value] = path[pathIndex .. ^ 1 ]
437+ if pathIndex < path.len:
438+ ctx.request.pathParams[node.value] = path[pathIndex .. ^ 1 ]
439+ else :
440+ ctx.request.pathParams[node.value] = " "
435441 pathIndex = path.len
436442 else :
437- ctx.request.pathParams[node.value] = path[pathIndex .. newPathIndex - 1 ]
443+ if pathIndex < newPathIndex:
444+ ctx.request.pathParams[node.value] = path[pathIndex .. newPathIndex - 1 ]
445+ else :
446+ ctx.request.pathParams[node.value] = " "
438447 pathIndex = newPathIndex
439448
440449 if pathIndex == path.len and node.isTerminator: # the path was exhausted and we reached a node that has a handler
You can’t perform that action at this time.
0 commit comments