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"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -102,7 +103,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
info := h.dir[req.URL.Path]
|
info := h.dir[path.Clean(req.URL.Path)]
|
||||||
if info == nil {
|
if info == nil {
|
||||||
http.NotFound(w, req)
|
http.NotFound(w, req)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue