From d0c365c5328e56e1857be1df11ea44d3bf116289 Mon Sep 17 00:00:00 2001 From: Daryl Lim Date: Sun, 24 Mar 2024 16:40:25 -0700 Subject: [PATCH] fix(engine): Fix possibly unbound action inputs during clone --- tracecat/db.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tracecat/db.py b/tracecat/db.py index 517fd2c99..81e003be5 100644 --- a/tracecat/db.py +++ b/tracecat/db.py @@ -346,6 +346,7 @@ def clone_workflow( ), ) + action_inputs: dict[str, str] = json.loads(cloned_action.inputs) if action.type == "webhook": cloned_webhook = Webhook( owner_id=new_owner_id, @@ -353,13 +354,11 @@ def clone_workflow( workflow_id=cloned_workflow.id, ) # Update the action inputs to point to the new webhook path - action_inputs: dict[str, str] = json.loads(cloned_action.inputs) action_inputs.update(path=cloned_webhook.id, secret=cloned_webhook.secret) - cloned_action.inputs = json.dumps(action_inputs) # Assert that there's a new computed secret session.add(cloned_webhook) - + cloned_action.inputs = json.dumps(action_inputs) action_replacements[action.id] = (cloned_action.id, action_inputs) session.add(cloned_action)