[SUPPORT] object: Fix buffer allocation for PayloadRange #1082

Merged
fyrchik merged 1 commit from acid-ant/frostfs-node:bugfix/1062-fix-range-support into support/v0.38 2024-04-09 11:19:53 +00:00

View file

@ -348,7 +348,7 @@ func PayloadRange(ctx context.Context, prm PayloadRangePrm) (*PayloadRangeRes, e
ln = maxInitialBufferSize ln = maxInitialBufferSize
} }
w := bytes.NewBuffer(make([]byte, ln)) w := bytes.NewBuffer(make([]byte, 0, ln))
_, err = io.CopyN(w, rdr, int64(prm.ln)) _, err = io.CopyN(w, rdr, int64(prm.ln))
if err != nil { if err != nil {
return nil, fmt.Errorf("read payload: %w", err) return nil, fmt.Errorf("read payload: %w", err)