flounder

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

commit de84128d6a9cc08765098317fba37afad12177ef
parent 5c53d0b31565f2de39eeb3753151736828b6c9c6
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 27 Dec 2020 21:26:56 -0800

Fix 404 error

Diffstat:
Mhttp.go | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/http.go b/http.go @@ -549,8 +549,8 @@ func userFile(w http.ResponseWriter, r *http.Request) { } var geminiContent string + _, err := os.Stat(path.Join(fullPath, "index.gmi")) if p == "/" || isDir { - _, err := os.Stat(path.Join(fullPath, "index.gmi")) if os.IsNotExist(err) { if p == "/gemlog" { geminiContent = generateGemfeedPage(userName) @@ -561,6 +561,10 @@ func userFile(w http.ResponseWriter, r *http.Request) { fullPath = path.Join(fullPath, "index.gmi") } } + if geminiContent == "" && os.IsNotExist(err) { + renderDefaultError(w, http.StatusNotFound) + return + } // Dumb content negotiation _, raw := r.URL.Query()["raw"] acceptsGemini := strings.Contains(r.Header.Get("Accept"), "text/gemini")