diff options
author | RW <ReneWerner87@googlemail.com> | 2020-06-04 16:53:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 16:53:47 +0200 |
commit | 853abb31af1b832ad8be99c97cd252f1df4e1bfe (patch) | |
tree | 6663e83b50f52cebe5a036721fa9ae441cccf042 /fs.go | |
parent | Support Windows SO_REUSEADDR (#822) (diff) | |
download | fasthttp-853abb31af1b832ad8be99c97cd252f1df4e1bfe.tar.gz fasthttp-853abb31af1b832ad8be99c97cd252f1df4e1bfe.tar.bz2 fasthttp-853abb31af1b832ad8be99c97cd252f1df4e1bfe.zip |
Co-authored-by: wernerr <rene.werner@verivox.com>
Diffstat (limited to 'fs.go')
-rw-r--r-- | fs.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -84,7 +84,7 @@ func ServeFile(ctx *RequestCtx, path string) { }) if len(path) == 0 || path[0] != '/' { // extend relative path to absolute path - hasTrailingSlash := path[len(path) - 1] == '/' + hasTrailingSlash := len(path) > 0 && path[len(path)-1] == '/' var err error if path, err = filepath.Abs(path); err != nil { ctx.Logger().Printf("cannot resolve path %q to absolute file path: %s", path, err) @@ -688,7 +688,7 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) { } else { path = ctx.Path() } - hasTrailingSlash := path[len(path) - 1] == '/' + hasTrailingSlash := len(path) > 0 && path[len(path)-1] == '/' path = stripTrailingSlashes(path) if n := bytes.IndexByte(path, 0); n >= 0 { |