bug: trailing slash issue

manually writing a dir caused path traversal issues in the html so we force a trailing slash to prevent this
This commit is contained in:
2026-07-18 04:03:57 -07:00
parent 5ae998f383
commit 75140f716d
+7
View File
@@ -152,6 +152,13 @@ func main() {
return
}
// Append trailing slash to directories so rendered HTML has proper paths
if filestat.IsDir() && !strings.HasSuffix(r.URL.Path, "/") {
r.URL.Path += "/"
http.Redirect(w, r, r.URL.String(), http.StatusMovedPermanently)
return
}
// Use Browser Cache (if possible)
modtime := filestat.ModTime().UTC()
modhash := fmt.Sprint(modtime.Unix())