Attachments: don't always generate new links.
Instead, we now just use file_storage.ensure_valid_link(), which takes link expiry into account.
This commit is contained in:
parent
3b6fa6ef27
commit
336ba7d6fe
@ -162,13 +162,14 @@ def item_parse_attachments(response):
|
|||||||
af['file'] = None
|
af['file'] = None
|
||||||
continue
|
continue
|
||||||
size = f['size'] if 'size' in f else 'l'
|
size = f['size'] if 'size' in f else 'l'
|
||||||
|
|
||||||
# Get the correct variation from the file
|
# Get the correct variation from the file
|
||||||
|
file_storage.ensure_valid_link(f)
|
||||||
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'],
|
|
||||||
str(f['project']))
|
|
||||||
# Build Markdown img string
|
# Build Markdown img string
|
||||||
l = ''.format(slug, l, f['name'])
|
l = ''.format(slug, thumbnail['link'], f['name'])
|
||||||
# Parse the content of the file and replace the attachment
|
# Parse the content of the file and replace the attachment
|
||||||
# tag with the actual image link
|
# tag with the actual image link
|
||||||
field_content = field_content.replace(slug_tag, l)
|
field_content = field_content.replace(slug_tag, l)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user