From 86ed7a3955c27d1c0826b9c00a5f79d6547afb37 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 6 Sep 2026 01:36:45 -0700 Subject: Use path.Clean so that directories can be routed --- roseh.moe.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roseh.moe.go b/roseh.moe.go index 32bcb6c..d28b1a5 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -28,6 +28,7 @@ import ( "net/http/httputil" "net/url" "os" + "path" "path/filepath" "slices" "strconv" @@ -264,7 +265,7 @@ func serveStaticFile(w http.ResponseWriter, r *http.Request, path string) { } func static(w http.ResponseWriter, r *http.Request) { - serveStaticFile(w, r, strings.TrimPrefix(r.URL.Path, "/")) + serveStaticFile(w, r, path.Clean(strings.TrimPrefix(r.URL.Path, "/"))) } func favicon(w http.ResponseWriter, r *http.Request) { -- cgit v1.3.1