Merge pull request #4136 from zyhfish/bug/fix-issue-4121

Fix #4121: avoid nested square bracket issue.
This commit is contained in:
Shaun Walker 2024-04-12 11:04:25 -04:00 committed by GitHub
commit 1dde79ace2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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