Missed a spot
This commit is contained in:
parent
9bc1fdea39
commit
8297f7bea8
|
@ -623,7 +623,7 @@ func localRedirect(w http.ResponseWriter, r *http.Request, newPath string) {
|
||||||
// ends in "/index.html" to the same path, without the final
|
// ends in "/index.html" to the same path, without the final
|
||||||
// "index.html". To avoid such redirects either modify the path or
|
// "index.html". To avoid such redirects either modify the path or
|
||||||
// use ServeContent.
|
// use ServeContent.
|
||||||
func ServeFile(w http.ResponseWriter, r *http.Request, name string) {
|
func ServeFile(w http.ResponseWriter, r *http.Request, name string, index bool) {
|
||||||
if containsDotDot(r.URL.Path) {
|
if containsDotDot(r.URL.Path) {
|
||||||
// Too many programs use r.URL.Path to construct the argument to
|
// Too many programs use r.URL.Path to construct the argument to
|
||||||
// serveFile. Reject the request under the assumption that happened
|
// serveFile. Reject the request under the assumption that happened
|
||||||
|
@ -634,7 +634,7 @@ func ServeFile(w http.ResponseWriter, r *http.Request, name string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dir, file := filepath.Split(name)
|
dir, file := filepath.Split(name)
|
||||||
serveFile(w, r, http.Dir(dir), file, false)
|
serveFile(w, r, http.Dir(dir), file, false, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
func containsDotDot(v string) bool {
|
func containsDotDot(v string) bool {
|
||||||
|
|
Loading…
Reference in New Issue