fix: Avoid issue if a cature is somewhat broken and we want to send a notification

pull/733/head
Raphaël Vinot 2023-07-06 14:50:38 +02:00
parent 2c5c30006c
commit 79c9b95faf
1 changed files with 5 additions and 1 deletions

View File

@ -730,7 +730,7 @@ class Lookyloo():
redirects = ''
initial_url = ''
cache = self.capture_cache(capture_uuid)
if cache:
if cache and hasattr(cache, 'url'):
if email_config['defang_urls']:
initial_url = defang(cache.url, colon=True, all_dots=True)
else:
@ -743,6 +743,10 @@ class Lookyloo():
redirects += '\n'.join(cache.redirects)
else:
redirects = "No redirects."
else:
initial_url = 'Unable to get URL from cache, this is probably a bug.'
if hasattr(cache, 'error'):
initial_url += f' - {cache.error}'
msg = EmailMessage()
msg['From'] = email_config['from']