From bb00909de4b716f560f76779e7d5a4a7de9965aa Mon Sep 17 00:00:00 2001 From: Feuerfuchs Date: Mon, 11 Nov 2019 21:39:48 +0100 Subject: Prefix instead of equality to determine page type --- gopherproxy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gopherproxy.go b/gopherproxy.go index a9396ef..8b33c05 100644 --- a/gopherproxy.go +++ b/gopherproxy.go @@ -160,7 +160,7 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, ass if res.Body != nil { if len(parts) < 2 { io.Copy(w, res.Body) - } else if parts[1] == "0" && !strings.HasSuffix(uri, ".xml") && !strings.HasSuffix(uri, ".asc") { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { + } else if strings.HasPrefix(parts[1], "0") && !strings.HasSuffix(uri, ".xml") && !strings.HasSuffix(uri, ".asc") { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { // handle .txt files buf := new(bytes.Buffer) buf.ReadFrom(res.Body) @@ -172,7 +172,7 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, ass Lines []Item Error bool }{uri, fmt.Sprintf("%s/%s", hostport, uri), assetList, buf.String(), nil, false}) - } else if parts[1] == "T" { + } else if strings.HasPrefix(parts[1], "T") { _, _, err = vips.NewTransform(). Load(res.Body). ResizeStrategy(vips.ResizeStrategyAuto). -- cgit v1.2.3-70-g09d2