Merge pull request #1051 from jakedt/blobcompensation
Fix the overlap condition on resumed uploads
This commit is contained in:
commit
dbdad16169
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:
|
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
|
# Skip the bytes which were received on a previous push, which are already stored and
|
||||||
# included in the sha calculation
|
# 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
|
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)
|
input_fp = wrap_with_handler(input_fp, found.sha_state.update)
|
||||||
|
|
||||||
|
|
Reference in a new issue