diff options
author | Victor Shyba <victor1984@riseup.net> | 2017-12-04 15:52:56 -0300 |
---|---|---|
committer | Victor Shyba <victor1984@riseup.net> | 2017-12-04 15:52:56 -0300 |
commit | 7f2eec3df3ee5e0eecdb25f064353992d1ec2436 (patch) | |
tree | d763cfef45009f868fe4992beb822cd95e45f76a /src/leap/soledad/client/_db/blobs | |
parent | 4afbe7fa6aee038bcaaf4c1c377d7e6921096d27 (diff) |
[bug] escape tag and size
It was generating spaces, causing split to fail sometimes.
Diffstat (limited to 'src/leap/soledad/client/_db/blobs')
-rw-r--r-- | src/leap/soledad/client/_db/blobs/__init__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/leap/soledad/client/_db/blobs/__init__.py b/src/leap/soledad/client/_db/blobs/__init__.py index b7b8ad1f..86e45381 100644 --- a/src/leap/soledad/client/_db/blobs/__init__.py +++ b/src/leap/soledad/client/_db/blobs/__init__.py @@ -128,9 +128,9 @@ class StreamDecrypterBuffer(object): self.buf += data if SEPARATOR in self.buf: marker, self.buf = self.buf.split(' ') - assert(len(marker) == 20) # 4 byte size + 16 byte tag - size, tag = marker[:4], marker[4:] - self.current_blob_size = self.size_pack.unpack(size)[0] + size, tag = marker[:8], marker[8:] + tag = base64.urlsafe_b64decode(tag) + self.current_blob_size = int(size, 16) self.received = len(self.buf) blob_id = self.blobs_list.pop(0) buf = DecrypterBuffer(blob_id, self.secret, tag) |