Skip to content

Commit

Permalink
Merge pull request #4136 from zyhfish/bug/fix-issue-4121
Browse files Browse the repository at this point in the history
Fix #4121: avoid nested square bracket issue.
  • Loading branch information
sbwalker authored Apr 12, 2024
2 parents e192383 + 5954fb9 commit 1dde79a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Oqtane.Server/Infrastructure/TokenReplace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public string ReplaceTokens(string source)
}

var result = new StringBuilder();
source = source.Replace("[[", "[$_["); //avoid nested square bracket issue.
foreach (Match match in this.TokenizerRegex.Matches(source))
{
var key = match.Result("${key}");
Expand Down Expand Up @@ -126,7 +127,7 @@ public string ReplaceTokens(string source)
result.Append(match.Result("${text}"));
}
}

result.Replace("[$_", "["); //restore the changes.
return result.ToString();
}

Expand Down

0 comments on commit 1dde79a

Please sign in to comment.