diff options
| author | chrislu <chris.lu@gmail.com> | 2022-08-31 00:10:17 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-08-31 00:10:17 -0700 |
| commit | ef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02 (patch) | |
| tree | 15753715ca21ae4c6572524d07fc84abdb15d509 | |
| parent | 9c944377dc8256f33f2c5634c1183cadc5cb5063 (diff) | |
| download | seaweedfs-ef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02.tar.xz seaweedfs-ef78631a7c2a1fc3de874d85ea08b7e8d9d3ca02.zip | |
just a bit safer
| -rw-r--r-- | weed/util/http_util.go | 3 |
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() |
