aboutsummaryrefslogtreecommitdiff
path: root/weed/util/http_util.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/http_util.go')
-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()