Fix for attachment processing

This commit is contained in:
Francesco Siddi 2016-03-25 21:05:31 +01:00
parent 8b4e0c4578
commit 9bdba2bc15

View File

@ -261,9 +261,11 @@ def item_parse_attachments(response):
for f in attachment['files']:
slug = f['slug']
slug_tag = "[{0}]".format(slug)
f = files_collection.find_one({'_id': f['file']})
f = files_collection.find_one({'_id': ObjectId(f['file'])})
if f is None:
abort(404)
size = f['size'] if 'size' in f else 'l'
# Get the correc variation from the file
# Get the correct variation from the file
thumbnail = next((item for item in f['variations'] if
item['size'] == size), None)
l = file_storage.generate_link(f['backend'], thumbnail['file_path'],