mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 19:10:54 +00:00
fix bug
This commit is contained in:
parent
d562687868
commit
8a99591298
@ -69,6 +69,7 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) {
|
|||||||
route := &controllerInfo{}
|
route := &controllerInfo{}
|
||||||
route.regex = regex
|
route.regex = regex
|
||||||
route.params = params
|
route.params = params
|
||||||
|
route.pattern = pattern
|
||||||
route.controllerType = t
|
route.controllerType = t
|
||||||
|
|
||||||
p.routers = append(p.routers, route)
|
p.routers = append(p.routers, route)
|
||||||
@ -146,7 +147,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
|
|||||||
for _, route := range p.fixrouters {
|
for _, route := range p.fixrouters {
|
||||||
n := len(requestPath)
|
n := len(requestPath)
|
||||||
if (requestPath[n-1] != '/' && route.pattern == requestPath) ||
|
if (requestPath[n-1] != '/' && route.pattern == requestPath) ||
|
||||||
(len(route.pattern) >= n && requestPath[0:n] == route.pattern) {
|
(len(route.pattern) >= n && requestPath[0:n-1] == route.pattern) {
|
||||||
runrouter = route
|
runrouter = route
|
||||||
findrouter = true
|
findrouter = true
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user