aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeuerfuchs <git@feuerfuchs.dev>2019-06-30 12:11:27 +0200
committerFeuerfuchs <git@feuerfuchs.dev>2019-06-30 12:11:27 +0200
commit2da6ce3a73daa919a2cdb2518367e92ffc4274f9 (patch)
tree111e16d4bb56351352c1a60e35696fb534d318ce
parentAdd CLI flag for the concurrency level of libvips (diff)
downloadgopherproxy-2da6ce3a73daa919a2cdb2518367e92ffc4274f9.tar.gz
gopherproxy-2da6ce3a73daa919a2cdb2518367e92ffc4274f9.tar.bz2
gopherproxy-2da6ce3a73daa919a2cdb2518367e92ffc4274f9.zip
Fix len check while checking the URI for response
-rw-r--r--gopherproxy.go4
1 files changed, 3 insertions, 1 deletions
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
143 } 143 }
144 144
145 if res.Body != nil { 145 if res.Body != nil {
146 if len(parts) >= 2 && parts[1] == "0" { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") { 146 if len(parts) < 2 {
147 io.Copy(w, res.Body)
148 } else if parts[1] == "0" { //strings.HasSuffix(uri, ".txt") || strings.HasSuffix(uri, ".md") {
147 // handle .txt files 149 // handle .txt files
148 buf := new(bytes.Buffer) 150 buf := new(bytes.Buffer)
149 buf.ReadFrom(res.Body) 151 buf.ReadFrom(res.Body)