summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authorVictor Shyba <victor1984@riseup.net>2017-03-20 21:37:20 -0300
committerdrebs <drebs@leap.se>2017-04-04 18:27:36 +0200
commita7539317d4847a9eb9fe431709ddab23e54f4be3 (patch)
tree8720b4dac045cf631d3f7b8ffc704d6d4f485396 /server/src
parent6d41e299538c9af9ef9d0536a423faa119113b49 (diff)
[bug] create dirs before checking disk usage
Diffstat (limited to 'server/src')
-rw-r--r--server/src/leap/soledad/server/_blobs.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/src/leap/soledad/server/_blobs.py b/server/src/leap/soledad/server/_blobs.py
index 4b0cd0de..c9b78005 100644
--- a/server/src/leap/soledad/server/_blobs.py
+++ b/server/src/leap/soledad/server/_blobs.py
@@ -120,7 +120,10 @@ class FilesystemBlobsBackend(object):
def write_blob(self, user, blob_id, request):
path = self._get_path(user, blob_id)
- logger.info('writing blob: %s - %s' % (user, blob_id))
+ try:
+ os.makedirs(os.path.split(path)[0])
+ except:
+ pass
if os.path.isfile(path):
# XXX return some 5xx code
raise BlobAlreadyExists()
@@ -131,11 +134,7 @@ class FilesystemBlobsBackend(object):
request.write('Quota Exceeded!')
request.finish()
return NOT_DONE_YET
- try:
- os.makedirs(os.path.split(path)[0])
- except:
- pass
- logger.debug("writing blob: %s" % path)
+ logger.info('writing blob: %s - %s' % (user, blob_id))
fbp = FileBodyProducer(request.content)
d = fbp.startProducing(open(path, 'wb'))
d.addCallback(lambda _: request.finish())