1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-30 08:46:41 +02:00

Fixed static middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana 2017-03-08 12:18:00 -08:00
parent 023cc02cdd
commit 4a9bc8c40e

View File

@ -85,18 +85,20 @@ func StaticWithConfig(config StaticConfig) echo.MiddlewareFunc {
}
if fi.IsDir() {
if config.Browse {
return listDir(name, c.Response())
}
name = filepath.Join(name, config.Index)
fi, err = os.Stat(name)
index := filepath.Join(name, config.Index)
fi, err = os.Stat(index)
if err != nil {
if config.Browse {
return listDir(name, c.Response())
}
if os.IsNotExist(err) {
return next(c)
}
return err
}
return c.File(name)
return c.File(index)
}
return c.File(name)