diff --git a/tasks/ReplaceTokensV3/index.ts b/tasks/ReplaceTokensV3/index.ts index 8f1d125..c66d80a 100644 --- a/tasks/ReplaceTokensV3/index.ts +++ b/tasks/ReplaceTokensV3/index.ts @@ -318,8 +318,8 @@ var replaceTokensInString = function ( if (options.useLegacyEmptyFeature && options.emptyValue && value === options.emptyValue) // old empty/default feature value = ''; - // apply recursion on value (never apply escape) - if (options.enableRecursion) + // apply recursion on non-empty value (never apply escape) + if (value && options.enableRecursion) value = replaceTokensInString(value, regex, transformRegex, options, false, escapeType, counter, names + name); // apply transformation diff --git a/tasks/ReplaceTokensV4/index.ts b/tasks/ReplaceTokensV4/index.ts index f8c16f9..c1a98c6 100644 --- a/tasks/ReplaceTokensV4/index.ts +++ b/tasks/ReplaceTokensV4/index.ts @@ -318,8 +318,8 @@ var replaceTokensInString = function ( if (options.useLegacyEmptyFeature && options.emptyValue && value === options.emptyValue) // old empty/default feature value = ''; - // apply recursion on value (never apply escape) - if (options.enableRecursion) + // apply recursion on non-empty value (never apply escape) + if (value && options.enableRecursion) value = replaceTokensInString(value, regex, transformRegex, options, false, escapeType, counter, names + name); // apply transformation diff --git a/tasks/ReplaceTokensV5/index.ts b/tasks/ReplaceTokensV5/index.ts index 1fa1a66..20658b8 100644 --- a/tasks/ReplaceTokensV5/index.ts +++ b/tasks/ReplaceTokensV5/index.ts @@ -318,8 +318,8 @@ var replaceTokensInString = function ( if (options.useLegacyEmptyFeature && options.emptyValue && value === options.emptyValue) // old empty/default feature value = ''; - // apply recursion on value (never apply escape) - if (options.enableRecursion) + // apply recursion on non-empty value (never apply escape) + if (value && options.enableRecursion) value = replaceTokensInString(value, regex, transformRegex, options, false, escapeType, counter, names + name); // apply transformation