From 1db6135e79b010b1552b985612581360b8f2cb05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 19 Nov 2024 16:25:58 +0100 Subject: [PATCH] fix: Avoid exception when there are no cookies --- website/web/genericapi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/web/genericapi.py b/website/web/genericapi.py index 054a601e..daa377c3 100644 --- a/website/web/genericapi.py +++ b/website/web/genericapi.py @@ -462,7 +462,9 @@ class CaptureInfo(Resource): # type: ignore[misc] params={'capture_uuid': 'The UUID of the capture'}) class CaptureCookies(Resource): # type: ignore[misc] def get(self, capture_uuid: str) -> dict[str, Any]: - return json.loads(lookyloo.get_cookies(capture_uuid).read()) + if cookies := lookyloo.get_cookies(capture_uuid).read(): + return json.loads(cookies) + return {} @api.route('/json//report')