Merge pull request #290 from joshp123/List_multipart_uploads_with_prefix
Added support for listing multipart uploads with prefix.
This commit is contained in:
commit
367302a18f
@ -81,10 +81,13 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
|||||||
|
|
||||||
def _bucket_response_get(self, bucket_name, querystring, headers):
|
def _bucket_response_get(self, bucket_name, querystring, headers):
|
||||||
if 'uploads' in querystring:
|
if 'uploads' in querystring:
|
||||||
for unsup in ('delimiter', 'prefix', 'max-uploads'):
|
for unsup in ('delimiter', 'max-uploads'):
|
||||||
if unsup in querystring:
|
if unsup in querystring:
|
||||||
raise NotImplementedError("Listing multipart uploads with {} has not been implemented yet.".format(unsup))
|
raise NotImplementedError("Listing multipart uploads with {} has not been implemented yet.".format(unsup))
|
||||||
multiparts = list(self.backend.get_all_multiparts(bucket_name).values())
|
multiparts = list(self.backend.get_all_multiparts(bucket_name).values())
|
||||||
|
if 'prefix' in querystring:
|
||||||
|
prefix = querystring.get('prefix', [None])[0]
|
||||||
|
multiparts = [upload for upload in multiparts if upload.key_name.startswith(prefix)]
|
||||||
template = self.response_template(S3_ALL_MULTIPARTS)
|
template = self.response_template(S3_ALL_MULTIPARTS)
|
||||||
return 200, headers, template.render(
|
return 200, headers, template.render(
|
||||||
bucket_name=bucket_name,
|
bucket_name=bucket_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user