1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 18:10:55 +00:00

reduce loop

This commit is contained in:
astaxie 2015-12-18 00:14:28 +08:00
parent a4f674e7f4
commit 5e249772d5

View File

@ -334,7 +334,7 @@ func (t *Tree) match(pattern string, wildcardValues []string, ctx *context.Conte
}
}
}
if runObject == nil {
if runObject == nil && len(t.fixrouters) > 0 {
// Filter the .json .xml .html extension
for _, str := range allowSuffixExt {
if strings.HasSuffix(seg, str) {
@ -353,7 +353,7 @@ func (t *Tree) match(pattern string, wildcardValues []string, ctx *context.Conte
runObject = t.wildcard.match(pattern, append(wildcardValues, seg), ctx)
}
if runObject == nil {
if runObject == nil && len(t.leaves) > 0 {
wildcardValues = append(wildcardValues, seg)
start, i := 0, 0
for ; i < len(pattern); i++ {