aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeuerfuchs <git@feuerfuchs.dev>2019-11-11 21:39:48 +0100
committerFeuerfuchs <git@feuerfuchs.dev>2019-11-11 21:39:48 +0100
commitbb00909de4b716f560f76779e7d5a4a7de9965aa (patch)
tree5eb62c390877e92b9e61c74554528c23bee01482
parentDon't show .xml and .asc files in template, update demo URL (diff)
downloadgopherproxy-bb00909de4b716f560f76779e7d5a4a7de9965aa.tar.gz
gopherproxy-bb00909de4b716f560f76779e7d5a4a7de9965aa.tar.bz2
gopherproxy-bb00909de4b716f560f76779e7d5a4a7de9965aa.zip
Prefix instead of equality to determine page type
-rw-r--r--gopherproxy.go4
1 files 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
160 if res.Body != nil { 160 if res.Body != nil {
161 if len(parts) < 2 { 161 if len(parts) < 2 {
162 io.Copy(w, res.Body) 162 io.Copy(w, res.Body)
163 } else if parts[1] == "0" && !strings.HasSuffix(uri, ".xml") && !strings.HasSuffix(uri, ".asc") { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { 163 } else if strings.HasPrefix(parts[1], "0") && !strings.HasSuffix(uri, ".xml") && !strings.HasSuffix(uri, ".asc") { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") {
164 // handle .txt files 164 // handle .txt files
165 buf := new(bytes.Buffer) 165 buf := new(bytes.Buffer)
166 buf.ReadFrom(res.Body) 166 buf.ReadFrom(res.Body)
@@ -172,7 +172,7 @@ func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, ass
172 Lines []Item 172 Lines []Item
173 Error bool 173 Error bool
174 }{uri, fmt.Sprintf("%s/%s", hostport, uri), assetList, buf.String(), nil, false}) 174 }{uri, fmt.Sprintf("%s/%s", hostport, uri), assetList, buf.String(), nil, false})
175 } else if parts[1] == "T" { 175 } else if strings.HasPrefix(parts[1], "T") {
176 _, _, err = vips.NewTransform(). 176 _, _, err = vips.NewTransform().
177 Load(res.Body). 177 Load(res.Body).
178 ResizeStrategy(vips.ResizeStrategyAuto). 178 ResizeStrategy(vips.ResizeStrategyAuto).