aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-08-31 00:10:17 -0700
committerchrislu <chris.lu@gmail.com>2022-08-31 00:10:17 -0700
commitef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02 (patch)
tree15753715ca21ae4c6572524d07fc84abdb15d509
parent9c944377dc8256f33f2c5634c1183cadc5cb5063 (diff)
downloadseaweedfs-ef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02.tar.xz
seaweedfs-ef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02.zip
just a bit safer
-rw-r--r--weed/util/http_util.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go
index 748bb6e87..bb1a32ede 100644
--- a/weed/util/http_util.go
+++ b/weed/util/http_util.go
@@ -408,6 +408,9 @@ func ReadUrlAsReaderCloser(fileUrl string, jwt string, rangeHeader string) (*htt
}
func CloseResponse(resp *http.Response) {
+ if resp == nil || resp.Body == nil {
+ return
+ }
reader := &CountingReader{reader: resp.Body}
io.Copy(io.Discard, reader)
resp.Body.Close()