Add S3 functionality to copy range. Closes #526.
This commit is contained in:
parent
6803444d61
commit
79addb8926
3 changed files with 16 additions and 5 deletions
|
|
@ -409,9 +409,17 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
|||
if 'x-amz-copy-source' in request.headers:
|
||||
src = request.headers.get("x-amz-copy-source")
|
||||
src_bucket, src_key = src.split("/", 1)
|
||||
src_range = request.headers.get('x-amz-copy-source-range', '').split("bytes=")[-1]
|
||||
|
||||
try:
|
||||
start_byte, end_byte = src_range.split("-")
|
||||
start_byte, end_byte = int(start_byte), int(end_byte)
|
||||
except ValueError:
|
||||
start_byte, end_byte = None, None
|
||||
|
||||
key = self.backend.copy_part(
|
||||
bucket_name, upload_id, part_number, src_bucket,
|
||||
src_key)
|
||||
src_key, start_byte, end_byte)
|
||||
template = self.response_template(S3_MULTIPART_UPLOAD_RESPONSE)
|
||||
response = template.render(part=key)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue