add dumb content negotiation
alex wennerberg alex@alexwennerberg.com
Mon, 09 Nov 2020 16:59:27 -0800
1 files changed,
3 insertions(+),
1 deletions(-)
jump to
M
http.go
→
http.go
@@ -417,7 +417,9 @@ http.ServeFile(w, r, path.Join(c.TemplatesDirectory, "static/style.css"))
} query := r.URL.Query() _, raw := query["raw"] - if !raw && (extension == ".gmi" || extension == ".gemini") { + // dumb content negotiation + acceptsGemini := strings.Contains(r.Header.Get("Accept"), "text/gemini") + if !raw && !acceptsGemini && (extension == ".gmi" || extension == ".gemini") { _, err := os.Stat(fileName) if err != nil { renderError(w, "404: file not found", 404)