Handler: call path.Clean first

Cope with things like /foo//bar by calling path.Clean before searching for
path in the map.
This commit is contained in:
Laurence Withers 2019-03-29 09:17:15 +00:00
parent 5c05a75fba
commit d42094ea72
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"net"
"net/http"
"os"
"path"
"strconv"
"strings"
"time"
@ -102,7 +103,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
return
}
info := h.dir[req.URL.Path]
info := h.dir[path.Clean(req.URL.Path)]
if info == nil {
http.NotFound(w, req)
return