mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Using filepath instead of path
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
c9a581815a
commit
27cedaf411
6
echo.go
6
echo.go
@ -8,7 +8,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
spath "path"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -382,7 +382,7 @@ func (e *Echo) ServeDir(path, dir string) {
|
||||
// ServeFile serves a file.
|
||||
func (e *Echo) ServeFile(path, file string) {
|
||||
e.Get(path, func(c *Context) error {
|
||||
dir, file := spath.Split(file)
|
||||
dir, file := filepath.Split(file)
|
||||
return serveFile(dir, file, c)
|
||||
})
|
||||
}
|
||||
@ -396,7 +396,7 @@ func serveFile(dir, file string, c *Context) error {
|
||||
|
||||
fi, _ := f.Stat()
|
||||
if fi.IsDir() {
|
||||
file = spath.Join(file, indexFile)
|
||||
file = filepath.Join(file, indexFile)
|
||||
f, err = fs.Open(file)
|
||||
if err != nil {
|
||||
return NewHTTPError(http.StatusForbidden)
|
||||
|
Loading…
Reference in New Issue
Block a user