mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
dropbox: fix infinite loop on uploading a corrupted file
Before this change, if rclone attempted to upload a file which read more bytes than the size it declared then the uploader would enter an infinite loop. See: https://forum.rclone.org/t/transfer-percentages-100-again/32109
This commit is contained in:
parent
72227a0151
commit
3a8e52de74
|
@ -1697,6 +1697,9 @@ func (o *Object) uploadChunked(ctx context.Context, in0 io.Reader, commitInfo *f
|
|||
if size > 0 {
|
||||
// if size is known, check if next chunk is final
|
||||
appendArg.Close = uint64(size)-in.BytesRead() <= uint64(chunkSize)
|
||||
if in.BytesRead() > uint64(size) {
|
||||
return nil, fmt.Errorf("expected %d bytes in input, but have read %d so far", size, in.BytesRead())
|
||||
}
|
||||
} else {
|
||||
// if size is unknown, upload as long as we can read full chunks from the reader
|
||||
appendArg.Close = in.BytesRead()-cursor.Offset < uint64(chunkSize)
|
||||
|
|
Loading…
Reference in New Issue
Block a user