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

Details

    • Problem report
    • Status: Confirmed
    • Major
    • Resolution: Unresolved
    • 5.0.30, 6.0.12, 6.2.6, 6.4.0beta5
    • None
    • Templates (T)

    Description

      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);
                  } 

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: