[ZBX-20150] Telegram Media type: some characters break MarkdownV2 syntax Created: 2021 Nov 01 Updated: 2024 Apr 10 Resolved: 2021 Nov 29 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Templates (T) |
Affects Version/s: | 5.0.17, 5.4.7, 6.0.0alpha6, 6.0 (plan) |
Fix Version/s: | 5.0.19rc1, 5.4.9rc1, 6.0.0beta1, 6.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Tikhon Uskov | Assignee: | Andrew Biba |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Team: | |
Sprint: | Sprint 82 (Nov 2021) |
Story Points: | 1 |
Description |
Telegram using MarkdownV2 syntax, but we don't nave a tool to escape special characters in user-defined and event macros. Some of this characters often used in names of host and etc. Following the Telegram documentation special characters should be escaped via backslash. Users now have only 3 ways: escapeMarkup: function (str) { var length = str.length, result = '', markup = ['_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']; for (var i = 0; i < length; i++) { var char = str[i]; result += (markup.indexOf(char) !== -1) ? ('\\' + char) : char; } return result; 3. not use message templates, hardcode this in JS and use the same function for escaping only macro content As my opinion would be great to add a escape function for non-word characters with escape-character as parameter to all macros like {HOST.HOST}.escape('\') |
Comments |
Comment by Andrew Biba [ 2021 Nov 12 ] |
Available in:
|