From 654ec33efae4050f513f6e9d3f1b33c3a39dbedf Mon Sep 17 00:00:00 2001 From: drebs Date: Fri, 1 Sep 2017 08:07:21 -0300 Subject: [bug] use a different name for each user's blobs db --- src/leap/soledad/client/_db/blobs.py | 7 ++++--- src/leap/soledad/client/api.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/leap') diff --git a/src/leap/soledad/client/_db/blobs.py b/src/leap/soledad/client/_db/blobs.py index 4a3cd913..7015ae5b 100644 --- a/src/leap/soledad/client/_db/blobs.py +++ b/src/leap/soledad/client/_db/blobs.py @@ -175,7 +175,7 @@ class BlobManager(object): cert_file=None): if local_path: mkdir_p(os.path.dirname(local_path)) - self.local = SQLiteBlobBackend(local_path, key) + self.local = SQLiteBlobBackend(local_path, key=key, user=user) self.remote = remote self.secret = secret self.user = user @@ -409,9 +409,10 @@ class BlobManager(object): class SQLiteBlobBackend(object): - def __init__(self, path, key=None): + def __init__(self, path, key=None, user=None): + dbname = '%s_blobs.db' % (user or 'soledad') self.path = os.path.abspath( - os.path.join(path, 'soledad_blob.db')) + os.path.join(path, dbname)) mkdir_p(os.path.dirname(self.path)) if not key: raise ValueError('key cannot be None') diff --git a/src/leap/soledad/client/api.py b/src/leap/soledad/client/api.py index 50f7e5aa..7171761d 100644 --- a/src/leap/soledad/client/api.py +++ b/src/leap/soledad/client/api.py @@ -275,7 +275,7 @@ class Soledad(object): return sync_phase, sync_exchange_phase def _init_blobmanager(self): - path = os.path.join(os.path.dirname(self._local_db_path), 'blobs') + path = os.path.dirname(self._local_db_path) url = urlparse.urljoin(self.server_url, 'blobs/%s' % self.uuid) key = self._secrets.local_key self.blobmanager = blobs.BlobManager( -- cgit v1.2.3