From 05b5c10b6c2eeb5a05963c1489e576a5e12a89c9 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Thu, 10 Aug 2017 00:39:50 -0300 Subject: [bug] enforce namespace to default on server This commit is complementary to the previous one. It adds a test for the reported bug (listing default namespace was listing others) and fixes it. -- Related: #8882 --- src/leap/soledad/server/_blobs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/leap') diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py index dc2c204c..f7db9218 100644 --- a/src/leap/soledad/server/_blobs.py +++ b/src/leap/soledad/server/_blobs.py @@ -143,6 +143,7 @@ class FilesystemBlobsBackend(object): def list_blobs(self, user, request, namespace='', order_by=None, filter_flag=False): + namespace = namespace or 'default' blob_ids = [] base_path = self._get_path(user, namespace=namespace) for root, dirs, filenames in os.walk(base_path): @@ -286,7 +287,7 @@ class BlobsResource(resource.Resource): for arg in request.postpath: if arg and not VALID_STRINGS.match(arg): raise Exception('Invalid blob resource argument: %s' % arg) - namespace = request.args.get('namespace', [''])[0] + namespace = request.args.get('namespace', ['default'])[0] if namespace and not VALID_STRINGS.match(namespace): raise Exception('Invalid blob namespace: %s' % namespace) return request.postpath + [namespace] -- cgit v1.2.3