summaryrefslogtreecommitdiff
path: root/fbin/file_storage
diff options
context:
space:
mode:
Diffstat (limited to 'fbin/file_storage')
-rw-r--r--fbin/file_storage/s3.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/fbin/file_storage/s3.py b/fbin/file_storage/s3.py
index 9e68186..a11488f 100644
--- a/fbin/file_storage/s3.py
+++ b/fbin/file_storage/s3.py
@@ -29,7 +29,11 @@ class Storage(BaseStorage):
if not size:
obj = self.client.ObjectSummary(self.app.config['S3_BUCKET'], key)
size = obj.size
- return self.add_file(file_hash, uploaded_file.filename, size, user, ip)
+ try:
+ return self.add_file(file_hash, uploaded_file.filename, size, user, ip)
+ except:
+ obj.delete()
+ raise
def get_file(self, f, thumb=False):
key = self.get_object_key(f, thumb=thumb)