forked from TrueCloudLab/rclone
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
1 changed files with 7 additions and 1 deletions
|
@ -417,7 +417,13 @@ func (up *largeUpload) Stream(ctx context.Context, initialUploadBlock *pool.RW)
|
|||
} else {
|
||||
n, err = io.CopyN(rw, up.in, up.chunkSize)
|
||||
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
|
||||
} else if err != nil {
|
||||
// other kinds of errors indicate failure
|
||||
|
|
Loading…
Reference in a new issue