Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix when if buffer is not aligned

Chris Lu865a01793696
diff --git a/weed/util/http_util.go b/weed/util/http_util.go
index 7b28d3d914..56c294f0d5 100644
--- a/weed/util/http_util.go
+++ b/weed/util/http_util.go
@@ -129,11 +129,10 @@ func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachB
if r.StatusCode != 200 {
return fmt.Errorf("%s: %s", url, r.Status)
}
- bufferSize := len(allocatedBytes)
for {
n, err := r.Body.Read(allocatedBytes)
- if n == bufferSize {
- eachBuffer(allocatedBytes)
+ if n > 0 {
+ eachBuffer(allocatedBytes[:n])
}
if err != nil {
if err == io.EOF {