diff options
Diffstat (limited to 'fbin/file_storage')
-rw-r--r-- | fbin/file_storage/s3.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fbin/file_storage/s3.py b/fbin/file_storage/s3.py index b372dd7..25b204c 100644 --- a/fbin/file_storage/s3.py +++ b/fbin/file_storage/s3.py @@ -62,7 +62,12 @@ class Storage(BaseStorage): kwargs = {} if 'Range' in request.headers: kwargs['Range'] = request.headers['Range'] - data = obj.get(**kwargs) + try: + data = obj.get(**kwargs) + except botocore.exceptions.ClientError as e: + if e.response['Error']['Code'] == 'NoSuchKey': + return + raise rv = send_file(data['Body'], attachment_filename=f.filename) rv.headers['Content-Length'] = data['ContentLength'] rv.headers['Accept-Ranges'] = data['AcceptRanges'] |