diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-05-24 23:20:56 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-05-24 23:20:56 -0700 |
| commit | c11d84f31414997ac43c3c1e638fe762318110d8 (patch) | |
| tree | 4b011151035b1b35a50ff5b86a97892694b9866a | |
| parent | 7b81cf37628bfabc4ac6018c4b123dbd245ed158 (diff) | |
| download | seaweedfs-c11d84f31414997ac43c3c1e638fe762318110d8.tar.xz seaweedfs-c11d84f31414997ac43c3c1e638fe762318110d8.zip | |
fix reading from a url
| -rw-r--r-- | weed/util/http_util.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 00dbdf90f..6494041e3 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -201,7 +201,10 @@ func ReadUrl(fileUrl string, offset int64, size int, buf []byte) (n int64, e err var i, m int for { - m, err = r.Body.Read(buf[i:cap(buf)]) + m, err = r.Body.Read(buf[i:]) + if m == 0 { + return + } i += m n += int64(m) if err == io.EOF { |
