From 2da6ce3a73daa919a2cdb2518367e92ffc4274f9 Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Sun, 30 Jun 2019 12:11:27 +0200 Subject: Fix len check while checking the URI for response --- gopherproxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gopherproxy.go b/gopherproxy.go index 0134f88..6490b28 100644 --- a/gopherproxy.go +++ b/gopherproxy.go @@ -143,7 +143,9 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, ass } if res.Body != nil { - if len(parts) >= 2 && parts[1] == "0" { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { + if len(parts) < 2 { + io.Copy(w, res.Body) + } else if 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