From 113b0b3d8e1345ec740cad8115f1e74c5b0eca05 Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Fri, 21 Jun 2019 15:46:45 +0200 Subject: Check type instead of file ext to render text via tpl --- gopherproxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gopherproxy.go b/gopherproxy.go index 8ba515e..11c08d5 100644 --- a/gopherproxy.go +++ b/gopherproxy.go @@ -132,7 +132,7 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, rob } if res.Body != nil { - if strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { + if len(parts) >= 2 && parts[1] == "0" { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { // handle .txt files buf := new(bytes.Buffer) buf.ReadFrom(res.Body) -- cgit v1.2.3-70-g09d2