mirror of
https://github.com/labstack/echo.git
synced 2025-05-21 22:33:35 +02:00
parent
bcbd9a0f42
commit
2dc1d53da5
5
echo.go
5
echo.go
@ -422,8 +422,9 @@ func (e *Echo) add(method, path string, handler HandlerFunc, middleware ...Middl
|
|||||||
func (e *Echo) Group(prefix string, m ...MiddlewareFunc) (g *Group) {
|
func (e *Echo) Group(prefix string, m ...MiddlewareFunc) (g *Group) {
|
||||||
g = &Group{prefix: prefix, echo: e}
|
g = &Group{prefix: prefix, echo: e}
|
||||||
g.Use(m...)
|
g.Use(m...)
|
||||||
// Dummy handler so group can be used with static middleware.
|
// Dummy handler to use static middleware with groups
|
||||||
g.Get("", func(c Context) error {
|
// See also issue #446
|
||||||
|
g.Get("/", func(c Context) error {
|
||||||
return c.NoContent(http.StatusNotFound)
|
return c.NoContent(http.StatusNotFound)
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
@ -55,7 +55,7 @@ func StaticFromConfig(config StaticConfig) echo.MiddlewareFunc {
|
|||||||
return func(c echo.Context) error {
|
return func(c echo.Context) error {
|
||||||
fs := http.Dir(config.Root)
|
fs := http.Dir(config.Root)
|
||||||
p := c.Request().URL().Path()
|
p := c.Request().URL().Path()
|
||||||
if c.P(0) != "" { // If serving from `Group`, e.g. `/static/*`
|
if c.P(0) != "" { // If serving from `Group`, e.g. `/static*`
|
||||||
p = c.P(0)
|
p = c.P(0)
|
||||||
}
|
}
|
||||||
file := path.Clean(p)
|
file := path.Clean(p)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user