flounder

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

commit 3341469aa1b6cea92fc842b606343e1d8d996687
parent 2f0de77571c138443f9ea6ebba0991acda64d670
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon,  9 Nov 2020 16:59:27 -0800

add dumb content negotiation

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

diff --git a/http.go b/http.go @@ -417,7 +417,9 @@ func userFile(w http.ResponseWriter, r *http.Request) { } 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)