Closed Taitava closed 2 years ago
Should be fixed now, will be released later in 0.11.1
.
Released.
I added still one fixing commit (db85689a7638117a2796c4af4a71c23cec8a5c64) related to this bug. However, I did not notice that there would be any problem without this particular fix, so it's only a "just in case" fix. It will be released together with #178. I think I won't add this to CHANGELOG.md
as it's so small thing.
Edit: Wrong commit id.
Discussed in https://github.com/Taitava/obsidian-shellcommands/discussions/170#discussioncomment-2280710
Now that I've inspected more, I've found out this regex is not so kind to unicode characters that are encoded with more than two bytes: https://github.com/Taitava/obsidian-shellcommands/blob/9eca3355893d5ded67c79669f3e878b9d2495158/src/variables/escapers/AllSpecialCharactersEscaper.ts#L10 The regex splits e.g. 🐓 to two characters and escapes them with two backquotes
`
(PowerShell) or two backslashes\
(Bash/Dash/Zsh). So, 🐓 becomes:`�`�
(PowerShell) or\�\�
(Bash/Dash/Zsh). The correct result would be:`🐓
(PowerShell) or\🐓
(Bash/Dash/Zsh).The problem can be fixed by adding a unicode flag to the regex pattern:
This bug was born in version
0.7.0
when implementing #11 . So, unescaped variable values (the{{!
exclamation mark variable}}
syntax ) are not affected by this bug.I'll add the unicode flag to all regex patterns in the whole plugin. I'll compile a list of all the changed regex patterns here.
Commit ffcedc069091effd5114ba7a43d92b31d089354b fixes the original bug.
Commit b496091c0ade6fe4e5ca14145ba2f93ed9b3e9a9 adds the
/u
modifier to the following other regex patterns: