flounder

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

commit 02f6ab33ee8df5a395fa7ee824e85a8e833b6841
parent eb22734b0e46270fc4f4224a073142d01423997b
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 27 Dec 2020 20:59:24 -0800

fix bug

Diffstat:
Mgemini.go | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gemini.go b/gemini.go @@ -89,9 +89,12 @@ func gmiPage(w *gmi.ResponseWriter, r *gmi.Request) { log.Println("Request for gemini file", fileName, "for user", userName) if fileName == "/gemlog" { // temp hack - w.SetMediaType("text/gemini") - io.Copy(w, strings.NewReader(generateGemfeedPage(userName))) - return + _, err := os.Stat(path.Join(c.FilesDirectory, userName, fileName, "index.gmi")) + if err != nil { + w.SetMediaType("text/gemini") + io.Copy(w, strings.NewReader(generateGemfeedPage(userName))) + return + } } gmi.ServeFile(w, gmi.Dir(path.Join(c.FilesDirectory, userName)), fileName)