Checks if index is greater than the length of the wildcards. #1580

This commit is contained in:
Henrique Bejgel 2016-01-18 21:35:14 -02:00
parent 4b52a38183
commit 35e340b937
1 changed files with 5 additions and 1 deletions

View File

@ -420,7 +420,11 @@ func (leaf *leafInfo) match(wildcardValues []string, ctx *context.Context) (ok b
if len(strs) == 2 {
ctx.Input.SetParam(":ext", strs[1])
}
ctx.Input.SetParam(":path", path.Join(path.Join(wildcardValues[index:len(wildcardValues)-1]...), strs[0]))
if index > (len(wildcardValues) - 1) {
ctx.Input.SetParam(":path", "")
} else {
ctx.Input.SetParam(":path", path.Join(path.Join(wildcardValues[index:len(wildcardValues)-1]...), strs[0]))
}
return true
}
// match :id