mirror of https://github.com/CIRCL/lookyloo
fix: Avoid exceptions on invalid requests
parent
4280a4e11f
commit
49f335405e
|
@ -94,6 +94,8 @@ class AsyncCapture(AbstractManager):
|
||||||
self.thirdparty_submit(url)
|
self.thirdparty_submit(url)
|
||||||
else:
|
else:
|
||||||
self.logger.warning(f'Invalid capture {to_capture}.')
|
self.logger.warning(f'Invalid capture {to_capture}.')
|
||||||
|
await lazy_cleanup.execute()
|
||||||
|
return
|
||||||
|
|
||||||
self.logger.info(f'Capturing {url} - {uuid}')
|
self.logger.info(f'Capturing {url} - {uuid}')
|
||||||
success, error_message = await self._capture(
|
success, error_message = await self._capture(
|
||||||
|
|
|
@ -898,7 +898,9 @@ def capture_web():
|
||||||
elif request.form.get('urls'):
|
elif request.form.get('urls'):
|
||||||
# bulk query
|
# bulk query
|
||||||
bulk_captures = []
|
bulk_captures = []
|
||||||
for url in request.form['urls'].split('\n'):
|
for url in request.form['urls'].strip().split('\n'):
|
||||||
|
if not url:
|
||||||
|
continue
|
||||||
query = capture_query.copy()
|
query = capture_query.copy()
|
||||||
query['url'] = url
|
query['url'] = url
|
||||||
new_capture_uuid = lookyloo.enqueue_capture(query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
new_capture_uuid = lookyloo.enqueue_capture(query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
||||||
|
@ -912,6 +914,8 @@ def capture_web():
|
||||||
perma_uuid = lookyloo.enqueue_capture(capture_query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
perma_uuid = lookyloo.enqueue_capture(capture_query, source='web', user=user, authenticated=flask_login.current_user.is_authenticated)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
return redirect(url_for('tree', tree_uuid=perma_uuid))
|
||||||
|
else:
|
||||||
|
flash('Invalid submission: please submit at least a URL or a document.', 'error')
|
||||||
elif request.method == 'GET' and request.args.get('url'):
|
elif request.method == 'GET' and request.args.get('url'):
|
||||||
url = unquote_plus(request.args['url']).strip()
|
url = unquote_plus(request.args['url']).strip()
|
||||||
capture_query = {'url': url}
|
capture_query = {'url': url}
|
||||||
|
|
Loading…
Reference in New Issue