summaryrefslogtreecommitdiff
path: root/src/leap/soledad/client
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-07-24 18:11:14 -0300
committerVictor Shyba <victor1984@riseup.net>2017-08-03 05:33:01 -0300
commit841db9f072401f2b6f40873b35c733723a54de36 (patch)
treedb64800de5858aca58f42547e4086a79274e7dfd /src/leap/soledad/client
parent8fc244cb0946f46ba9aff019b70568d08a226b29 (diff)
[bug] make download namespace-aware
Diffstat (limited to 'src/leap/soledad/client')
-rw-r--r--src/leap/soledad/client/_db/blobs.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py
index 148e1ff1..e95f9d9e 100644
--- a/src/leap/soledad/client/_db/blobs.py
+++ b/src/leap/soledad/client/_db/blobs.py
@@ -302,13 +302,13 @@ class BlobManager(object):
defer.returnValue((yield response.json()))
@defer.inlineCallbacks
- def get(self, blob_id):
+ def get(self, blob_id, namespace=None):
local_blob = yield self.local.get(blob_id)
if local_blob:
logger.info("Found blob in local database: %s" % blob_id)
defer.returnValue(local_blob)
- result = yield self._download_and_decrypt(blob_id)
+ result = yield self._download_and_decrypt(blob_id, namespace)
if not result:
defer.returnValue(None)
@@ -347,11 +347,12 @@ class BlobManager(object):
logger.info("Finished upload: %s" % (blob_id,))
@defer.inlineCallbacks
- def _download_and_decrypt(self, blob_id):
+ def _download_and_decrypt(self, blob_id, namespace=None):
logger.info("Staring download of blob: %s" % blob_id)
# TODO this needs to be connected in a tube
uri = urljoin(self.remote, self.user + '/' + blob_id)
- data = yield self._client.get(uri)
+ params = {'namespace': namespace} if namespace else None
+ data = yield self._client.get(uri, params=params)
if data.code == 404:
logger.warn("Blob not found in server: %s" % blob_id)