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; } }