File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -271,18 +271,22 @@ func addParameterMetaInfo(segs []*routeSegment) []*routeSegment {
271
271
272
272
// findNextParamPosition search for the next possible parameter start position
273
273
func findNextParamPosition (pattern string ) int {
274
+ // Find the first parameter position
274
275
nextParamPosition := findNextNonEscapedCharsetPosition (pattern , parameterStartChars )
276
+
277
+ // If pattern contains a parameter and it's not a wildcard
275
278
if nextParamPosition != - 1 && len (pattern ) > nextParamPosition && pattern [nextParamPosition ] != wildcardParam {
276
- // search for parameter characters for the found parameter start,
277
- // if there are more, move the parameter start to the last parameter char
278
- for found := findNextNonEscapedCharsetPosition (pattern [ nextParamPosition + 1 :], parameterStartChars ); found == 0 ; {
279
- nextParamPosition ++
280
- if len ( pattern ) > nextParamPosition {
279
+ // checking the found parameterStartChar is a cluster
280
+ i := nextParamPosition + 1
281
+ for i < len (pattern ) {
282
+ if findNextNonEscapedCharsetPosition ( pattern [ i : i + 1 ], parameterStartChars ) != 0 {
283
+ // It was a single parameter start char or end of cluster
281
284
break
282
285
}
286
+ nextParamPosition ++
287
+ i ++
283
288
}
284
289
}
285
-
286
290
return nextParamPosition
287
291
}
288
292
You can’t perform that action at this time.
0 commit comments