summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatt Arnold <matt@thegnuguru.org>2023-06-05 22:38:21 -0400
committerMatt Arnold <matt@thegnuguru.org>2023-06-05 22:38:21 -0400
commitf4c02022c62135bfebbfdba7c4bca692a74c8c85 (patch)
treef0ded7c50aeff9370e744d24ed73898b9e27e5fa
parent484ca735031d3bec2534d16a73e4c6626dae8daa (diff)
change one thing at a time
-rw-r--r--main.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/main.go b/main.go
index 26f8859..64e9c9a 100644
--- a/main.go
+++ b/main.go
@@ -192,9 +192,6 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt
 	}
 	defer resp.Body.Close()
 
-	if err != nil {
-		return nil, err
-	}
 	var tmp bytes.Buffer
 	if strings.EqualFold(resp.Header.Get("Content-Encoding"), "gzip") {
 		log.Println("Yes we gziped")
@@ -228,7 +225,6 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt
 			return nil, err
 		}
 
-		resp.Body = io.NopCloser(&tmp)
 	} else {
 		_, err = io.Copy(&tmp, resp.Body)
 		if err != nil {
@@ -236,6 +232,9 @@ func fetch(fetchurl string, user_agent string, parser_select bool, original *htt
 		}
 		resp.Body.Close()
 	}
+	if tmp.Len() > 1 {
+		return nil, errors.New("watson this is weird")
+	}
 
 	publishUrl, err := url.Parse(fetchurl)
 	if err != nil {