mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-23 15:49:49 +01:00
Fix resumable uploads
Only increment the start offset when the response is successful and seek to the start offset on each iteration.
This commit is contained in:
@@ -694,8 +694,9 @@ impl<'a, A> ResumableUploadHelper<'a, A> {
|
||||
_ => MIN_CHUNK_SIZE,
|
||||
};
|
||||
|
||||
self.reader.seek(SeekFrom::Start(start)).unwrap();
|
||||
loop {
|
||||
self.reader.seek(SeekFrom::Start(start)).unwrap();
|
||||
|
||||
let request_size = match self.content_length - start {
|
||||
rs if rs > chunk_size => chunk_size,
|
||||
rs => rs,
|
||||
@@ -711,7 +712,6 @@ impl<'a, A> ResumableUploadHelper<'a, A> {
|
||||
}),
|
||||
total_length: self.content_length,
|
||||
};
|
||||
start += request_size;
|
||||
if self.delegate.cancel_chunk_upload(&range_header) {
|
||||
return None;
|
||||
}
|
||||
@@ -730,6 +730,8 @@ impl<'a, A> ResumableUploadHelper<'a, A> {
|
||||
.await;
|
||||
match res {
|
||||
Ok(res) => {
|
||||
start += request_size;
|
||||
|
||||
if res.status() == StatusCode::PERMANENT_REDIRECT {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user