Fix for attachment processing
This commit is contained in:
@@ -261,9 +261,11 @@ def item_parse_attachments(response):
|
|||||||
for f in attachment['files']:
|
for f in attachment['files']:
|
||||||
slug = f['slug']
|
slug = f['slug']
|
||||||
slug_tag = "[{0}]".format(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'
|
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
|
thumbnail = next((item for item in f['variations'] if
|
||||||
item['size'] == size), None)
|
item['size'] == size), None)
|
||||||
l = file_storage.generate_link(f['backend'], thumbnail['file_path'],
|
l = file_storage.generate_link(f['backend'], thumbnail['file_path'],
|
||||||
|
Reference in New Issue
Block a user