Fix index.gmi last-modified bug
alex wennerberg alex@alexwennerberg.com
Sun, 21 Feb 2021 15:56:56 -0800
1 files changed,
5 insertions(+),
2 deletions(-)
jump to
M
http.go
→
http.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) }