all repos — flounder @ 3341469aa1b6cea92fc842b606343e1d8d996687

A small site builder for the Gemini protocol

add dumb content negotiation
alex wennerberg alex@alexwennerberg.com
Mon, 09 Nov 2020 16:59:27 -0800
commit

3341469aa1b6cea92fc842b606343e1d8d996687

parent

2f0de77571c138443f9ea6ebba0991acda64d670

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M http.gohttp.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)