flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit c0eb142b022116e58d16ed5462a4966110419a19
parent 285e08242443d7803b1beb2b522f6ca183db6ef5
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat,  9 Jan 2021 23:21:29 -0800

Redirect slash for folders

Diffstat:
Mhttp.go | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/http.go b/http.go @@ -580,6 +580,10 @@ func userFile(w http.ResponseWriter, r *http.Request) { var geminiContent string _, err = os.Stat(path.Join(fullPath, "index.gmi")) if isDir { + // redirect slash + if !strings.HasSuffix(r.URL.Path, "/") { + http.Redirect(w, r, p+"/", http.StatusSeeOther) + } if os.IsNotExist(err) { if p == "/gemlog" { geminiContent = generateGemfeedPage(userName)