fix: run cleanup properly when auto_report == 0

pull/913/head
Raphaël Vinot 2024-04-29 17:26:46 +02:00
parent d324def48f
commit 9eb14548e3
1 changed files with 5 additions and 3 deletions

View File

@ -102,17 +102,19 @@ class AsyncCapture(AbstractManager):
) )
if 'auto_report' in to_capture: if 'auto_report' in to_capture:
send_report = True
settings = {} settings = {}
if isinstance(to_capture['auto_report'], str): if isinstance(to_capture['auto_report'], str):
if to_capture['auto_report'].isdigit(): if to_capture['auto_report'].isdigit():
# auto_report was a bool in the submission, it can be 1 or 0. 0 means no. # auto_report was a bool in the submission, it can be 1 or 0. 0 means no.
if to_capture['auto_report'] == '0': if to_capture['auto_report'] == '0':
continue send_report = False
else: else:
settings = json.loads(to_capture['auto_report']) settings = json.loads(to_capture['auto_report'])
elif isinstance(to_capture['auto_report'], dict): elif isinstance(to_capture['auto_report'], dict):
settings = to_capture['auto_report'] settings = to_capture['auto_report']
if send_report:
self.lookyloo.send_mail(uuid, email=settings.get('email', ''), self.lookyloo.send_mail(uuid, email=settings.get('email', ''),
comment=settings.get('comment')) comment=settings.get('comment'))