all repos — homestead @ 71872e707a08ee966605f7415da5600a1165ffc5

Code for my website

fix path canonicalisation

Alan Pearce
commit

71872e707a08ee966605f7415da5600a1165ffc5

parent

c4d30eb9557b00e9bab34163a63db2d5047c201e

1 file changed, 2 insertions(+), 1 deletion(-)

jump to
M cmd/server/server.gocmd/server/server.go
@@ -101,12 +101,13 @@ Code int
} func canonicalisePath(path string) (cPath string, differs bool) { + cPath = path if strings.HasSuffix(path, "/index.html") { cPath, differs = strings.CutSuffix(path, "index.html") } else if !strings.HasSuffix(path, "/") && files[path+"/"] != (File{}) { cPath, differs = path+"/", true } - return path, differs + return cPath, differs } func serveFile(w http.ResponseWriter, r *http.Request) *HTTPError {