diff --git a/backend/b2/upload.go b/backend/b2/upload.go index ef0102347..777852b1a 100644 --- a/backend/b2/upload.go +++ b/backend/b2/upload.go @@ -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