mirror of https://github.com/gin-gonic/gin.git
Fixes pathFor()
This commit is contained in:
parent
d0fb4a6bf0
commit
cc94aa2dd9
2
gin.go
2
gin.go
|
@ -144,7 +144,7 @@ func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *Rout
|
||||||
func (group *RouterGroup) pathFor(p string) string {
|
func (group *RouterGroup) pathFor(p string) string {
|
||||||
joined := path.Join(group.prefix, p)
|
joined := path.Join(group.prefix, p)
|
||||||
// Append a '/' if the last component had one, but only if it's not there already
|
// Append a '/' if the last component had one, but only if it's not there already
|
||||||
if len(p) > 0 && p[len(p)-1] == '/' && joined[len(p)-1] != '/' {
|
if len(p) > 0 && p[len(p)-1] == '/' && joined[len(joined)-1] != '/' {
|
||||||
return joined + "/"
|
return joined + "/"
|
||||||
}
|
}
|
||||||
return joined
|
return joined
|
||||||
|
|
Loading…
Reference in New Issue