From b3be2e208cb373207d6199cac5a9fc92be073e7a Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 12 Mar 2022 19:41:07 +0100 Subject: Update dependencies and vendor (#1761) --- vendor/github.com/labstack/echo/v4/context_fs.go | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vendor/github.com/labstack/echo/v4/context_fs.go (limited to 'vendor/github.com/labstack/echo/v4/context_fs.go') diff --git a/vendor/github.com/labstack/echo/v4/context_fs.go b/vendor/github.com/labstack/echo/v4/context_fs.go new file mode 100644 index 00000000..11ee84bc --- /dev/null +++ b/vendor/github.com/labstack/echo/v4/context_fs.go @@ -0,0 +1,33 @@ +//go:build !go1.16 +// +build !go1.16 + +package echo + +import ( + "net/http" + "os" + "path/filepath" +) + +func (c *context) File(file string) (err error) { + f, err := os.Open(file) + if err != nil { + return NotFoundHandler(c) + } + defer f.Close() + + fi, _ := f.Stat() + if fi.IsDir() { + file = filepath.Join(file, indexPage) + f, err = os.Open(file) + if err != nil { + return NotFoundHandler(c) + } + defer f.Close() + if fi, err = f.Stat(); err != nil { + return + } + } + http.ServeContent(c.Response(), c.Request(), fi.Name(), fi.ModTime(), f) + return +} -- cgit v1.2.3