From 74f1f3e1cab149f47a42e08546cad53ad178bdb3 Mon Sep 17 00:00:00 2001 From: Michael Franklin Date: Wed, 3 Apr 2024 14:52:25 +1100 Subject: [PATCH] Make get_extra_audit_log_values more defensive --- api/utils/db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/utils/db.py b/api/utils/db.py index 0dc17fa8b..9cb8c6515 100644 --- a/api/utils/db.py +++ b/api/utils/db.py @@ -35,7 +35,11 @@ def get_extra_audit_log_values(request: Request) -> dict | None: if not headers: return None - return json.loads(headers) + try: + return json.loads(headers) + except json.JSONDecodeError: + logging.error(f'Could not parse sm-extra-values: {headers}') + return None def get_on_behalf_of(request: Request) -> str | None: