Fix the overlap condition on resumed uploads
This commit is contained in:
parent
35437c9f55
commit
9f13bb8960
1 changed files with 10 additions and 1 deletions
|
@ -204,8 +204,17 @@ def _upload_chunk(namespace, repo_name, upload_uuid):
|
|||
if start_offset > 0 and start_offset < found.byte_count:
|
||||
# Skip the bytes which were received on a previous push, which are already stored and
|
||||
# included in the sha calculation
|
||||
input_fp = StreamSlice(input_fp, found.byte_count - start_offset)
|
||||
overlap_size = found.byte_count - start_offset
|
||||
input_fp = StreamSlice(input_fp, overlap_size)
|
||||
|
||||
# Update our upload bounds to reflect the skipped portion of the overlap
|
||||
start_offset = found.byte_count
|
||||
length = max(length - overlap_size, 0)
|
||||
|
||||
# We use this to escape early in case we have already processed all of the bytes the user
|
||||
# wants to upload
|
||||
if length == 0:
|
||||
return found
|
||||
|
||||
input_fp = wrap_with_handler(input_fp, found.sha_state.update)
|
||||
|
||||
|
|
Reference in a new issue