mirror of
https://github.com/kataras/iris.git
synced 2025-12-23 21:07:03 +00:00
Update to 7.2.0. Read https://github.com/kataras/iris/blob/master/HISTORY.md#th-15-june-2017--v720
Fix https://github.com/iris-contrib/community-board/issues/12 . Read more: https://github.com/kataras/iris/blob/master/HISTORY.md#th-15-june-2017--v720 Former-commit-id: 398cb69fdc7e5367b147693371287ffb7b912feb
This commit is contained in:
@@ -76,6 +76,15 @@ func (nodes *Nodes) add(path string, paramNames []string, handlers context.Handl
|
||||
// na to kanw na exei to node to diko tou wildcard parameter name
|
||||
// kai sto telos na pernei auto, me vasi to *paramname
|
||||
// alla edw mesa 9a ginete register vasi tou last /
|
||||
|
||||
// set the wildcard param name to the root and its children.
|
||||
wildcardIdx := strings.IndexByte(path, '*')
|
||||
wildcardParamName := ""
|
||||
if wildcardIdx > 0 {
|
||||
wildcardParamName = path[wildcardIdx+1:]
|
||||
path = path[0:wildcardIdx-1] + "/" // replace *paramName with single slash
|
||||
}
|
||||
|
||||
loop:
|
||||
for _, n := range *nodes {
|
||||
|
||||
@@ -97,14 +106,14 @@ loop:
|
||||
children: Nodes{
|
||||
{
|
||||
s: n.s[i:],
|
||||
wildcardParamName: n.wildcardParamName,
|
||||
wildcardParamName: wildcardParamName,
|
||||
paramNames: n.paramNames,
|
||||
children: n.children,
|
||||
handlers: n.handlers,
|
||||
},
|
||||
{
|
||||
s: path[i:],
|
||||
wildcardParamName: n.wildcardParamName,
|
||||
wildcardParamName: wildcardParamName,
|
||||
paramNames: paramNames,
|
||||
handlers: handlers,
|
||||
},
|
||||
@@ -117,12 +126,12 @@ loop:
|
||||
if len(path) < len(n.s) {
|
||||
*n = node{
|
||||
s: n.s[:len(path)],
|
||||
wildcardParamName: n.wildcardParamName,
|
||||
wildcardParamName: wildcardParamName,
|
||||
paramNames: paramNames,
|
||||
children: Nodes{
|
||||
{
|
||||
s: n.s[len(path):],
|
||||
wildcardParamName: n.wildcardParamName,
|
||||
wildcardParamName: wildcardParamName,
|
||||
paramNames: n.paramNames,
|
||||
children: n.children,
|
||||
handlers: n.handlers,
|
||||
@@ -144,7 +153,7 @@ loop:
|
||||
return nil
|
||||
}
|
||||
if len(n.handlers) > 0 { // n.handlers already setted
|
||||
return ErrDublicate
|
||||
return ErrDublicate.Append("for: %s", n.s)
|
||||
}
|
||||
n.paramNames = paramNames
|
||||
n.handlers = handlers
|
||||
@@ -152,15 +161,6 @@ loop:
|
||||
return
|
||||
}
|
||||
|
||||
// set the wildcard param name to the root.
|
||||
|
||||
wildcardIdx := strings.IndexByte(path, '*')
|
||||
wildcardParamName := ""
|
||||
if wildcardIdx > 0 {
|
||||
wildcardParamName = path[wildcardIdx+1:]
|
||||
path = path[0:wildcardIdx-1] + "/" // replace *paramName with single slash
|
||||
}
|
||||
|
||||
n := &node{
|
||||
s: path,
|
||||
wildcardParamName: wildcardParamName,
|
||||
|
||||
Reference in New Issue
Block a user