1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-27 22:38:25 +02:00

Fixed static middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2017-02-23 12:27:48 -08:00
parent 29fd5831ff
commit 049518f8c4
2 changed files with 13 additions and 1 deletions

View File

@@ -88,8 +88,17 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
if config.Browse {
return listDir(name, c.Response())
}
return c.File(filepath.Join(name, config.Index))
name = filepath.Join(name, config.Index)
fi, err = os.Stat(name)
if err != nil {
if os.IsNotExist(err) {
return next(c)
}
return err
}
return c.File(name)
}
return c.File(name)
}
}