Fix #4121: avoid nested square bracket issue.

This commit is contained in:
Ben 2024-04-12 21:56:49 +08:00
parent 07f367a2a5
commit 5954fb91be

View File

@ -93,6 +93,7 @@ namespace Oqtane.Infrastructure
}
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}");
@ -126,7 +127,7 @@ namespace Oqtane.Infrastructure
result.Append(match.Result("${text}"));
}
}
result.Replace("[$_", "["); //restore the changes.
return result.ToString();
}