From ad4f58324ab1f5481226643c800d3187c8eeafb7 Mon Sep 17 00:00:00 2001 From: luxick Date: Fri, 10 Apr 2026 12:21:53 +0200 Subject: [PATCH] Fix trailing slash issue --- main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 3fcd4b7..77b5651 100644 --- a/main.go +++ b/main.go @@ -103,6 +103,9 @@ fsPath := filepath.Join(h.root, filepath.FromSlash(urlPath)) } if info.IsDir() { + if urlPath != "/" { + urlPath += "/" + } h.serveDir(w, r, urlPath, fsPath) } else { http.ServeFile(w, r, fsPath) @@ -133,17 +136,12 @@ func (h *handler) serveDir(w http.ResponseWriter, r *http.Request, urlPath, fsPa entries = listEntries(fsPath, urlPath) } - postURL := urlPath - if urlPath == "/" { - postURL = "/" - } - data := pageData{ Title: pageTitle(urlPath), Crumbs: buildCrumbs(urlPath), CanEdit: true, EditMode: editMode, - PostURL: postURL, + PostURL: urlPath, RawContent: string(rawMD), Content: rendered, Entries: entries,