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:
parent
023cc02cdd
commit
4a9bc8c40e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user