• Sprint 82 (Nov 2021)
    • 1

      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:
      1. not use md characters in zabbix
      2. escape all conent of {ALERT.SUBJECT} and {ALERT.MESSAGE} in JS (double ascape used cause we use JSON) like here:

      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('\')

            abiba Andrew Biba
            lint Tikhon Uskov
            Team INT
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: