Fix delete keys detection with werkzeug request

This commit is contained in:
Daniel Miller 2016-01-22 12:33:13 -05:00
parent 595259a99d
commit 89d5c72d86
2 changed files with 12 additions and 6 deletions

View File

@ -24,8 +24,11 @@ def parse_key_name(pth):
return pth.lstrip("/")
def is_delete_keys(path, bucket_name):
return path == u'/?delete'
def is_delete_keys(request, path, bucket_name):
return path == u'/?delete' or (
path == u'/' and
getattr(request, "query_string", "") == "delete"
)
class ResponseObject(_TemplateEnvironmentMixin):
@ -50,9 +53,9 @@ class ResponseObject(_TemplateEnvironmentMixin):
def is_delete_keys(self, request, path, bucket_name):
if self.subdomain_based_buckets(request):
return is_delete_keys(path, bucket_name)
return is_delete_keys(request, path, bucket_name)
else:
return bucketpath_is_delete_keys(path, bucket_name)
return bucketpath_is_delete_keys(request, path, bucket_name)
def parse_bucket_name_from_url(self, request, url):
if self.subdomain_based_buckets(request):

View File

@ -15,5 +15,8 @@ def parse_key_name(path):
return "/".join(path.rstrip("/").split("/")[2:])
def is_delete_keys(path, bucket_name):
return path == u'/' + bucket_name + u'/?delete'
def is_delete_keys(request, path, bucket_name):
return path == u'/' + bucket_name + u'/?delete' or (
path == u'/' + bucket_name and
getattr(request, "query_string", "") == "delete"
)