summaryrefslogtreecommitdiff
path: root/src/leap/soledad/server
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-07-25 05:51:37 -0300
committerVictor Shyba <victor1984@riseup.net>2017-08-03 05:33:01 -0300
commit7007606e2fc10a836bb52ef3eb40db8b15f3c4ac (patch)
treea98f82bb148d61d460266961d1324f96ae637cb1 /src/leap/soledad/server
parent639d86626b8e519a966578b48b77c68f7076be35 (diff)
[bug] separate preamble from content on incoming resource
Diffstat (limited to 'src/leap/soledad/server')
-rw-r--r--src/leap/soledad/server/_incoming.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/leap/soledad/server/_incoming.py b/src/leap/soledad/server/_incoming.py
index 1d34f4f3..5dbbb627 100644
--- a/src/leap/soledad/server/_incoming.py
+++ b/src/leap/soledad/server/_incoming.py
@@ -18,6 +18,7 @@
A twisted resource that saves externally delivered documents into user's db.
"""
import json
+import base64
from twisted.web.server import NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.web.test.test_web import DummyRequest
@@ -66,7 +67,7 @@ class IncomingResource(Resource):
else:
raw_content = request.content.read()
preamble = self.formatter.preamble(raw_content, doc_id)
- request.content = BytesIO(preamble + raw_content)
+ request.content = BytesIO(preamble + ' ' + raw_content)
d = db.write_blob(uuid, doc_id, request, namespace='MX')
# FIXME: We really need to decouple request handling from the
# backend! This is very ugly, but will change when this refactor
@@ -107,5 +108,6 @@ class IncomingFormatter(object):
scheme = preamble.ENC_SCHEME.external
method = preamble.ENC_METHOD.pgp
size = len(raw_content)
- return preamble.Preamble(doc_id, rev, scheme, method,
- content_size=size).encode()
+ raw_preamble = preamble.Preamble(doc_id, rev, scheme, method,
+ content_size=size).encode()
+ return base64.urlsafe_b64encode(raw_preamble)