mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
Merge pull request #109 from syntaqx/directory-index
e.Static on Windows
This commit is contained in:
commit
011ea1958f
3
echo.go
3
echo.go
@ -8,6 +8,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
@ -339,7 +340,7 @@ func serveFile(dir, file string, c *Context) error {
|
|||||||
|
|
||||||
fi, _ := f.Stat()
|
fi, _ := f.Stat()
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
file = filepath.Join(file, "index.html")
|
file = path.Join(file, "index.html")
|
||||||
f, err = fs.Open(file)
|
f, err = fs.Open(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewHTTPError(http.StatusForbidden)
|
return NewHTTPError(http.StatusForbidden)
|
||||||
|
Loading…
Reference in New Issue
Block a user