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:
parent
5c05a75fba
commit
d42094ea72
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue