Link refresh: gracefully handle case where 'file_path' is not set.

In this case an error is logged and the entire link regeneration is
aborted. In other words, variations aren't refreshed either.
This commit is contained in:
Sybren A. Stüvel 2018-01-30 15:47:51 +01:00
parent 4b5a961e14
commit 9177f77e69

View File

@ -447,7 +447,14 @@ def generate_all_links(response, now):
response['project']) if 'project' in response else None
# TODO: add project id to all files
backend = response['backend']
response['link'] = generate_link(backend, response['file_path'], project_id)
if 'file_path' in response:
response['link'] = generate_link(backend, response['file_path'], project_id)
else:
import pprint
log.error('File without file_path properly, unable to generate links: %s',
pprint.pformat(response))
return
variations = response.get('variations')
if variations: