]> Cypherpunks.ru repositories - gocheese.git/commitdiff
Missing error check
authorSergey Matveev <stargrave@stargrave.org>
Wed, 29 Sep 2021 10:37:46 +0000 (13:37 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 29 Sep 2021 10:37:46 +0000 (13:37 +0300)
refresh.go

index fcee245b93d15fce58322dcf1c16c72d8770cd1c..83d00825a066b96bbbf11863072d13c8a8b93493 100644 (file)
@@ -116,6 +116,12 @@ func refreshDir(
                        return false
                }
                body, err := ioutil.ReadAll(resp.Body)
+               if err != nil {
+                       resp.Body.Close()
+                       log.Println("error", r.RemoteAddr, "refresh-json", pkgName, err)
+                       http.Error(w, "can not read body", http.StatusBadGateway)
+                       return false
+               }
                resp.Body.Close()
                var buf bytes.Buffer
                var description string