Use filepath.Clean for fileserver.

This commit is contained in:
Abiola Ibrahim 2016-03-11 15:39:13 +01:00
parent 741d7685f1
commit f3a183ecc1

View File

@ -4,6 +4,7 @@ import (
"net/http" "net/http"
"os" "os"
"path" "path"
"path/filepath"
"strings" "strings"
) )
@ -43,7 +44,7 @@ func (fh *fileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, e
upath = "/" + upath upath = "/" + upath
r.URL.Path = upath r.URL.Path = upath
} }
return fh.serveFile(w, r, path.Clean(upath)) return fh.serveFile(w, r, filepath.Clean(upath))
} }
// serveFile writes the specified file to the HTTP response. // serveFile writes the specified file to the HTTP response.