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

Widget: Graph download fails if multibyte is specified for host

XMLWordPrintable

    • Sprint 106 (Nov 2023), Sprint 107 (Dec 2023)
    • 1

      Steps to reproduce:

      1. [Configuration] -> [Hosts] -> Click any host
      2. Set multibyte characters for Visible name
      3. Add graph widget to dashboard to show multibyte hosts
      4. Download graphs from the widget menu

      Result:
      Download screen does not appear.
      The browser's DevTools outputs the following.

      Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
          at downloadSvgImage (http://127.0.0.1/jsLoader.php?lang=en_US&ver=6.0.23&showGuiMessaging=1:25677:45)
          at HTMLAnchorElement.clickCallback (http://127.0.0.1/jsLoader.php?ver=6.0.23&lang=en_US&files%5B0%5D=flickerfreescreen.js&files%5B1%5D=gtlc.js&files%5B2%5D=leaflet.js&files%5B3%5D=leaflet.markercluster.js&files%5B4%5D=class.dashboard.js&files%5B5%5D=class.dashboard.page.js&files%5B6%5D=class.dashboard.widget.placeholder.js&files%5B7%5D=class.geomaps.js&files%5B8%5D=class.widget.js&files%5B9%5D=class.widget.iterator.js&files%5B10%5D=class.widget.clock.js&files%5B11%5D=class.widget.geomap.js&files%5B12%5D=class.widget.graph.js&files%5B13%5D=class.widget.graph-prototype.js&files%5B14%5D=class.widget.item.js&files%5B15%5D=class.widget.map.js&files%5B16%5D=class.widget.navtree.js&files%5B17%5D=class.widget.paste-placeholder.js&files%5B18%5D=class.widget.problems.js&files%5B19%5D=class.widget.problemsbysv.js&files%5B20%5D=class.widget.svggraph.js&files%5B21%5D=class.widget.trigerover.js&files%5B22%5D=class.calendar.js&files%5B23%5D=layout.mode.js&files%5B24%5D=class.coverride.js&files%5B25%5D=class.crangecontrol.js&files%5B26%5D=colorpicker.js&files%5B27%5D=class.csvggraph.js&files%5B28%5D=class.cnavtree.js&files%5B29%5D=class.svg.canvas.js&files%5B30%5D=class.svg.map.js&files%5B31%5D=class.tagfilteritem.js&files%5B32%5D=class.sortable.js&files%5B33%5D=servercheck.js:12314:5)
          at HTMLAnchorElement.dispatch (http://127.0.0.1/jsLoader.php?lang=en_US&ver=6.0.23&showGuiMessaging=1:5432:27)
          at elemData.handle (http://127.0.0.1/jsLoader.php?lang=en_US&ver=6.0.23&showGuiMessaging=1:5236:28)
      

      It appears that the btoa function is failing to encode multibytes.
      Currently it seems to be occurring in all versions except 7.0alpha.
      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/ui/js/functions.js?at=refs%2Fheads%2Frelease%2F6.0#872

      The master branch seems to have a modification to this logic, and I was able to confirm that it can be downloaded by changing the source.
      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/ui/js/functions.js#823

               image.src = 'data:image/svg+xml;utf8,' + new XMLSerializer().serializeToString($clone[0]).replace(/#/g, '%23');
       //      image.src = 'data:image/svg+xml;base64,' + btoa(new XMLSerializer().serializeToString($clone[0]));
      

            gcalenko Gregory Chalenko
            hayato.watanabe Hayato Watanabe
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: