summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-09-06 01:36:45 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-09-06 01:37:03 -0700
commit86ed7a3955c27d1c0826b9c00a5f79d6547afb37 (patch)
tree653d8e0d33b43ecf1fdf2983e359625ea23b2ea3 /roseh.moe.go
parentUse ServeFileFS for static files (diff)
downloadroseh.moe-86ed7a3955c27d1c0826b9c00a5f79d6547afb37.tar.zst
Use path.Clean so that directories can be routed
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go3
1 files changed, 2 insertions, 1 deletions
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) {