mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 11:20:50 +00:00
Merge pull request #1581 from hbejgel/patch-2
Checks if index is greater than the length of the wildcards. #1580
This commit is contained in:
commit
fd7473466b
4
tree.go
4
tree.go
@ -420,7 +420,11 @@ func (leaf *leafInfo) match(wildcardValues []string, ctx *context.Context) (ok b
|
|||||||
if len(strs) == 2 {
|
if len(strs) == 2 {
|
||||||
ctx.Input.SetParam(":ext", strs[1])
|
ctx.Input.SetParam(":ext", strs[1])
|
||||||
}
|
}
|
||||||
|
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]))
|
ctx.Input.SetParam(":path", path.Join(path.Join(wildcardValues[index:len(wildcardValues)-1]...), strs[0]))
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// match :id
|
// match :id
|
||||||
|
Loading…
Reference in New Issue
Block a user