Fix the overlap condition on resumed uploads

This commit is contained in:
Jake Moshenko 2015-12-10 13:14:11 -05:00
parent 35437c9f55
commit 9f13bb8960

View file

@ -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)