all repos — website @ a20707fc8982d76e60c2e6cd058baa32334c7a4f

My website

fix path canonicalisation

Alan Pearce
commit

a20707fc8982d76e60c2e6cd058baa32334c7a4f

parent

d2a85e99c50b841ef93e59b732c6330c636b391f

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

changed files
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 {