Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-22134

Telegram integration does not process escape symbols on html mode

XMLWordPrintable

      Steps to reproduce:

      1. Send message in telegram with symbols <>

      Result:

      If this is a real problem i can offer my solution
      Add case 'html'

          escapeMarkup: function (str, mode) {
              switch (mode) {
                  case 'markdown':
                      return str.replace(/([_*\[`])/g, '\\$&');            case 'markdownv2':
                      return str.replace(/([_*\[\]()~`>#+\-=|{}.!])/g, '\\$&');            case 'html':
                      return str.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
              }
          }, 

      and add 'html' in list parsmode

                  if (['markdown', 'markdownv2', 'html'].indexOf(params.ParseMode) !== -1) {
                      Telegram.message = Telegram.escapeMarkup(Telegram.message, params.ParseMode);
                  } 

            atocko Andrey Tocko
            klimenko.andrei Klimenko Andrey
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: