From 8c7aecfa22f5850dfccd103004adc38c8aefed6f Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 3 Sep 2024 21:14:28 +0100 Subject: [PATCH] Update packages/server/src/api/routes/utils/validators.ts Co-authored-by: Sam Rose --- packages/server/src/api/routes/utils/validators.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/routes/utils/validators.ts b/packages/server/src/api/routes/utils/validators.ts index 9218223d08..d83569673f 100644 --- a/packages/server/src/api/routes/utils/validators.ts +++ b/packages/server/src/api/routes/utils/validators.ts @@ -298,8 +298,8 @@ const validateStepsArray = ( steps: AutomationStep[], helpers: Joi.CustomHelpers ) => { - for (let i = 0; i < steps.length - 1; i++) { - if (steps[i].stepId === AutomationActionStepId.BRANCH) { + for (const step of steps.slice(0, -1)) { + if (step.stepId === AutomationActionStepId.BRANCH) { return helpers.error("branchStepPosition") } }