mirror of
https://github.com/rclone/rclone.git
synced 2025-01-20 02:52:44 +08:00
b2: fix streaming chunked files an exact multiple of chunk size
Before this change, streaming files an exact multiple of the chunk size would cause rclone to attempt to stream a 0 sized chunk which was rejected by the b2 servers. This bug was noticed by the new integration tests for chunked streaming.
This commit is contained in:
parent
cc2a4c2e20
commit
8f47b6746d
|
@ -417,7 +417,13 @@ func (up *largeUpload) Stream(ctx context.Context, initialUploadBlock *pool.RW)
|
||||||
} else {
|
} else {
|
||||||
n, err = io.CopyN(rw, up.in, up.chunkSize)
|
n, err = io.CopyN(rw, up.in, up.chunkSize)
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
fs.Debugf(up.o, "Read less than a full chunk, making this the last one.")
|
if n == 0 {
|
||||||
|
fs.Debugf(up.o, "Not sending empty chunk after EOF - ending.")
|
||||||
|
up.f.putRW(rw)
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
fs.Debugf(up.o, "Read less than a full chunk %d, making this the last one.", n)
|
||||||
|
}
|
||||||
hasMoreParts = false
|
hasMoreParts = false
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
// other kinds of errors indicate failure
|
// other kinds of errors indicate failure
|
||||||
|
|
Loading…
Reference in New Issue
Block a user