From 1e3f2a1438374f656563e659ab00fdc619f66aa0 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 14 Jan 2025 23:14:20 -0800 Subject: [PATCH] Fix: dont try to parse empty params (#8742) --- src/documents/signals/handlers.py | 37 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/documents/signals/handlers.py b/src/documents/signals/handlers.py index 09ea7bf01..efba1e41c 100644 --- a/src/documents/signals/handlers.py +++ b/src/documents/signals/handlers.py @@ -992,25 +992,26 @@ def run_workflows( try: data = {} if action.webhook.use_params: - try: - for key, value in action.webhook.params.items(): - data[key] = parse_w_workflow_placeholders( - value, - correspondent, - document_type, - owner_username, - added, - filename, - current_filename, - created, - title, - doc_url, + if action.webhook.params: + try: + for key, value in action.webhook.params.items(): + data[key] = parse_w_workflow_placeholders( + value, + correspondent, + document_type, + owner_username, + added, + filename, + current_filename, + created, + title, + doc_url, + ) + except Exception as e: + logger.error( + f"Error occurred parsing webhook params: {e}", + extra={"group": logging_group}, ) - except Exception as e: - logger.error( - f"Error occurred parsing webhook params: {e}", - extra={"group": logging_group}, - ) else: data = parse_w_workflow_placeholders( action.webhook.body,