support cancelling of multipart upload
This commit is contained in:
parent
6e65b5f6d4
commit
b1d59c7e17
@ -164,6 +164,10 @@ class S3Backend(BaseBackend):
|
||||
|
||||
return self.set_key(bucket_name, multipart.key_name, value)
|
||||
|
||||
def cancel_multipart(self, bucket_name, multipart_id):
|
||||
bucket = self.buckets[bucket_name]
|
||||
del bucket.multiparts[multipart_id]
|
||||
|
||||
def list_multipart(self, bucket_name, multipart_id):
|
||||
bucket = self.buckets[bucket_name]
|
||||
return bucket.multiparts[multipart_id].list_parts()
|
||||
|
@ -188,6 +188,10 @@ def _key_response(request, full_url, headers):
|
||||
else:
|
||||
return 404, headers, ""
|
||||
elif method == 'DELETE':
|
||||
if 'uploadId' in query:
|
||||
upload_id = query['uploadId'][0]
|
||||
s3_backend.cancel_multipart(bucket_name, upload_id)
|
||||
return 204, headers, ""
|
||||
removed_key = s3_backend.delete_key(bucket_name, key_name)
|
||||
template = Template(S3_DELETE_OBJECT_SUCCESS)
|
||||
return 204, headers, template.render(bucket=removed_key)
|
||||
|
Loading…
Reference in New Issue
Block a user