flounder

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

commit 1d4b96b3233ee566a3f0538c01c172ad08bef3e5
parent 3cd022876f9a33d682bcc66b7095ee5741014954
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 29 Nov 2021 22:32:25 -0800

fix slash bugs

Diffstat:
Mgemini.go | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gemini.go b/gemini.go @@ -97,14 +97,14 @@ func gmiPage(_ context.Context, w gmi.ResponseWriter, r *gmi.Request) { return } fullPath := path.Join(c.FilesDirectory, userName, fileName) - if fileName == "/gemlog" { // temp hack + if fileName == "gemlog" { // temp hack _, err := os.Stat(path.Join(fullPath, "index.gmi")) if err != nil { w.WriteHeader(gmi.StatusSuccess, "text/gemini") io.Copy(w, strings.NewReader(generateGemfeedPage(userName))) return } - } else if fileName == "/gemlog/atom.xml" { + } else if fileName == "gemlog/atom.xml" { _, err := os.Stat(fullPath) if err != nil { w.WriteHeader(gmi.StatusSuccess, "application/atom+xml") @@ -114,6 +114,9 @@ func gmiPage(_ context.Context, w gmi.ResponseWriter, r *gmi.Request) { return } } + if fileName == "" { // mess + fileName = "/" + } gmi.ServeFile(w, os.DirFS(path.Join(c.FilesDirectory, userName)), fileName) }