about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-24 11:47:42 +0200
committerAlan Pearce2024-04-24 11:47:42 +0200
commita20707fc8982d76e60c2e6cd058baa32334c7a4f (patch)
tree3e781e2cd6cff90643d07649fa8b66c729fa4fc1
parentd2a85e99c50b841ef93e59b732c6330c636b391f (diff)
downloadwebsite-a20707fc8982d76e60c2e6cd058baa32334c7a4f.tar.lz
website-a20707fc8982d76e60c2e6cd058baa32334c7a4f.tar.zst
website-a20707fc8982d76e60c2e6cd058baa32334c7a4f.zip
fix path canonicalisation
-rw-r--r--cmd/server/server.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/server/server.go b/cmd/server/server.go
index 39feb86..9c9911a 100644
--- a/cmd/server/server.go
+++ b/cmd/server/server.go
@@ -101,12 +101,13 @@ type HTTPError struct {
 }
 
 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 {