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
|
||||
continue
|
||||
size = f['size'] if 'size' in f else 'l'
|
||||
|
||||
# Get the correct variation from the file
|
||||
file_storage.ensure_valid_link(f)
|
||||
thumbnail = next((item for item in f['variations'] if
|
||||
item['size'] == size), None)
|
||||
l = file_storage.generate_link(f['backend'], thumbnail['file_path'],
|
||||
str(f['project']))
|
||||
|
||||
# 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
|
||||
# tag with the actual image link
|
||||
field_content = field_content.replace(slug_tag, l)
|
||||
|
Loading…
x
Reference in New Issue
Block a user