Make LayerTooLarge error more informative
This commit is contained in:
parent
dd7f254f96
commit
239b6d7cf8
2 changed files with 20 additions and 14 deletions
|
@ -362,12 +362,7 @@ def _upload_chunk(blob_upload, range_header):
|
|||
# Check if we should raise 413 before accepting the data.
|
||||
uploaded = bitmath.Byte(length + start_offset)
|
||||
if length > -1 and uploaded > max_layer_size:
|
||||
detail = {
|
||||
'reason': '%s is greater than maximum allowed size %s' % (uploaded, max_layer_size),
|
||||
'max_allowed': max_layer_size.bytes,
|
||||
'uploaded': uploaded.bytes,
|
||||
}
|
||||
raise LayerTooLarge(detail=detail)
|
||||
raise LayerTooLarge(uploaded=uploaded.bytes, max_allowed=max_layer_size.bytes)
|
||||
|
||||
location_set = {blob_upload.location_name}
|
||||
|
||||
|
@ -451,12 +446,7 @@ def _upload_chunk(blob_upload, range_header):
|
|||
# Ensure we have not gone beyond the max layer size.
|
||||
upload_size = bitmath.Byte(blob_upload.byte_count)
|
||||
if upload_size > max_layer_size:
|
||||
detail = {
|
||||
'reason': '%s is greater than maximum allowed size %s' % (upload_size, max_layer_size),
|
||||
'max_allowed': max_layer_size.bytes,
|
||||
'uploaded': upload_size.bytes,
|
||||
}
|
||||
raise LayerTooLarge(detail=detail)
|
||||
raise LayerTooLarge(uploaded=upload_size.bytes, max_allowed=max_layer_size.bytes)
|
||||
|
||||
return blob_upload
|
||||
|
||||
|
|
Reference in a new issue