Commit f267ee8a authored by astaxie's avatar astaxie

fix the same name controller for UrlFor

parent 7e060e6e
......@@ -415,7 +415,7 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
}
}
}
controllName := strings.Join(paths[:len(paths)-1], ".")
controllName := strings.Join(paths[:len(paths)-1], "/")
methodName := paths[len(paths)-1]
for _, t := range p.routers {
ok, url := p.geturl(t, "/", controllName, methodName, params)
......@@ -443,7 +443,8 @@ func (p *ControllerRegistor) geturl(t *Tree, url, controllName, methodName strin
}
for _, l := range t.leaves {
if c, ok := l.runObject.(*controllerInfo); ok {
if c.routerType == routerTypeBeego && c.controllerType.Name() == controllName {
if c.routerType == routerTypeBeego &&
strings.HasSuffix(path.Join(c.controllerType.PkgPath(), c.controllerType.Name()), controllName) {
find := false
if _, ok := HTTPMETHOD[strings.ToUpper(methodName)]; ok {
if len(c.methods) == 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment