mirror of
https://github.com/labstack/echo.git
synced 2025-01-01 22:09:21 +02:00
bug fix static files in routing group (#642)
prefix is already applied to group and does not need to be applied again in the handler function
This commit is contained in:
parent
60b69fbb3b
commit
8686b3c5c7
4
group.go
4
group.go
@ -137,14 +137,14 @@ func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) *Group {
|
||||
|
||||
// Static implements `Echo#Static()` for sub-routes within the Group.
|
||||
func (g *Group) Static(prefix, root string) {
|
||||
g.GET(g.prefix+prefix+"*", func(c Context) error {
|
||||
g.GET(prefix+"*", func(c Context) error {
|
||||
return c.File(path.Join(root, c.P(0)))
|
||||
})
|
||||
}
|
||||
|
||||
// File implements `Echo#File()` for sub-routes within the Group.
|
||||
func (g *Group) File(path, file string) {
|
||||
g.GET(g.prefix+path, func(c Context) error {
|
||||
g.GET(path, func(c Context) error {
|
||||
return c.File(file)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user