[.NET][Templating] Expand function doesn't handle strings with escape characters
See original GitHub issuePlatform
What platform is your issue or question related to? (Delete other platforms).
- .NET (Templating nuget)
Author or host
Author / Host
If you’re an author, who are you sending cards to? 1.2.9
What version are you using? Ex: NuGet 1.0.2, or latest main, etc… Templating nuget release candidate
Explain your issue. If you just have a question, please post on StackOverflow instead:
- When expanding a templated json with a concrete type, any strings within that type that contain escape characters \ or " will break the json parser.
Example:
Given this template
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "${title}"
}
]
}
And expanding with a concrete type with Property
[JsonProperty("title")]
Title => return "Hello \ world";
Will result in a parsing error when the card is expanded and result in no card being displayed.
We’re currently working around this issue by manually escaping all strings we use, but it would be great if the templating system could handle strings that contain escape characters.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Process escape sequences in a string in Python
The plan is, we'll find escape sequences using a regular expression, and use a function as the argument to re.sub to replace them...
Read more >eval doesn't handle terminal escape sequences correctly
Version: 3.0.0 I am trying to call eval echo "[green]blah [red]$foo[black]" where [green] etc are terminal escape sequences. eval throws the ...
Read more >How to escape special characters in a string?
You don't need to escape any file names you are handling in a script. Escaping is only necessary if you want to put...
Read more >bash: how to pass command line arguments containing ...
In bash, double-quoting does not bypass expanding variables "$HOME" or parameters "${USER:-root}" , command substitution in either form "$(date) ...
Read more >Preventing Escape Sequence Interpretation in Python
If a match is found then the sequence is omitted from the string, ... The repr() function does not interpret the escape sequence...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @arvindkannan - the workaround I used was to write my own custom Adaptive Expression and replace the escape string characters
then use that inside my template like this:
Please reactivate if you’re still seeing this issue in the latest templating package.