address PR comments
This commit is contained in:
parent
16b451437f
commit
9f743fd6cd
4 changed files with 19 additions and 16 deletions
|
@ -343,9 +343,11 @@ def _upload_chunk(blob_upload, start_offset, length):
|
|||
"""
|
||||
# Check for invalidate arguments.
|
||||
if None in {blob_upload, start_offset, length}:
|
||||
logger.error('None provided as argument to _upload_chunk')
|
||||
return None
|
||||
|
||||
if start_offset > 0 and start_offset > blob_upload.byte_count:
|
||||
logger.error('start_offset provided to _upload_chunk greater than blob.upload.byte_count')
|
||||
return None
|
||||
|
||||
location_set = {blob_upload.location_name}
|
||||
|
@ -391,19 +393,17 @@ def _upload_chunk(blob_upload, start_offset, length):
|
|||
size_info, fn = calculate_size_handler()
|
||||
input_fp = wrap_with_handler(input_fp, fn)
|
||||
|
||||
try:
|
||||
length_written, new_metadata, error = storage.stream_upload_chunk(
|
||||
location_set,
|
||||
blob_upload.uuid,
|
||||
start_offset,
|
||||
length,
|
||||
input_fp,
|
||||
blob_upload.storage_metadata,
|
||||
content_type=BLOB_CONTENT_TYPE,
|
||||
)
|
||||
if error is not None:
|
||||
return None
|
||||
except InvalidChunkException:
|
||||
length_written, new_metadata, error = storage.stream_upload_chunk(
|
||||
location_set,
|
||||
blob_upload.uuid,
|
||||
start_offset,
|
||||
length,
|
||||
input_fp,
|
||||
blob_upload.storage_metadata,
|
||||
content_type=BLOB_CONTENT_TYPE,
|
||||
)
|
||||
if error is not None:
|
||||
logger.error('storage.stream_upload_chunk returned error %s', error)
|
||||
return None
|
||||
|
||||
# If we determined an uncompressed size and this is the first chunk, add it to the blob.
|
||||
|
|
Reference in a new issue