From eeca96a4a0b4071692fa259a8c8de67fdba27abc Mon Sep 17 00:00:00 2001 From: appunni-m <64424476+appunni-m@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:45:41 +0530 Subject: [PATCH] Fix: #3876 Update task utils: removeIterationFromTaskRefName Parsing name is not considering task ref name with double underscores - This is not fully fixing the use of this function. There needs to be some kind of validation against the user from setting up the taskRefName with double underscore --- .../java/com/netflix/conductor/common/utils/TaskUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/netflix/conductor/common/utils/TaskUtils.java b/common/src/main/java/com/netflix/conductor/common/utils/TaskUtils.java index 5e83bd73e7..a0521b19f1 100644 --- a/common/src/main/java/com/netflix/conductor/common/utils/TaskUtils.java +++ b/common/src/main/java/com/netflix/conductor/common/utils/TaskUtils.java @@ -26,6 +26,10 @@ public static String getLoopOverTaskRefNameSuffix(int iteration) { public static String removeIterationFromTaskRefName(String referenceTaskName) { String[] tokens = referenceTaskName.split(TaskUtils.LOOP_TASK_DELIMITER); - return tokens.length > 0 ? tokens[0] : referenceTaskName; + int length = tokens.length; + return length > 1 ? String.join( + TaskUtils.LOOP_TASK_DELIMITER, + Arrays.copyOf(tokens, length - 1) + ) : referenceTaskName; } }