all repos — flounder @ 66ef42c8bae6844baa685b03ba161bd68a510595

A small site builder for the Gemini protocol

Fix index.gmi last-modified bug
alex wennerberg alex@alexwennerberg.com
Sun, 21 Feb 2021 15:56:56 -0800
commit

66ef42c8bae6844baa685b03ba161bd68a510595

parent

9c90564237faf53d8ee70a963cfed465d372bdd3

1 files changed, 5 insertions(+), 2 deletions(-)

jump to
M http.gohttp.go

@@ -565,7 +565,7 @@ return

} var geminiContent string - _, err = os.Stat(path.Join(fullPath, "index.gmi")) + fullStat, err := os.Stat(path.Join(fullPath, "index.gmi")) if isDir { // redirect slash if !strings.HasSuffix(r.URL.Path, "/") {

@@ -579,6 +579,9 @@ geminiContent = generateFolderPage(fullPath)

} } else { fullPath = path.Join(fullPath, "index.gmi") + } + if fullStat != nil { + stat = fullStat // wonky } } if geminiContent == "" && os.IsNotExist(err) {

@@ -622,7 +625,7 @@ serverError(w, err)

return } breader := bytes.NewReader(buff.Bytes()) - http.ServeContent(w, r, "", stat.ModTime(), breader) + http.ServeContent(w, r, "", modTime, breader) } else { http.ServeFile(w, r, fullPath) }