IITC-CE / IITC-Button

Firefox/Chrome extensions that enables IITC features
GNU General Public License v3.0
16 stars 6 forks source link

Bug Report: Gaode Map tiles are broken #121

Closed gaotongsh closed 1 year ago

gaotongsh commented 1 year ago

Environment

Steps to reproduce

  1. Turn off Map Tiles > Gaode if it is on now
  2. Refresh
  3. Turn on Map Tiles > Gaode
  4. Refresh

Expected behavior

Gaode Map is choosable from the map tiles

Actual behavior

Gaode Map is not there

Console output

Uncaught (in promise) DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
    at o (chrome-extension://febaefghpimpenpigafpolgljcfkeakn/js/content-script.js:23:239)
    at HTMLDocument.a (chrome-extension://febaefghpimpenpigafpolgljcfkeakn/js/content-script.js:23:376)
    at <anonymous>:2:14
o       @   content-script.js:23
a       @   content-script.js:23
(anonymous) @   VM2895:2

And VM2895 is this snippet:

document.dispatchEvent(new CustomEvent('IITCButtonInitJS',{
    detail: {
        "plugin": {
            "author": "johnd0e",
            "category": "Map Tiles",
            "code": "// ==UserScript==\n// @author         johnd0e\n// @name ... TRUNCATED HERE",
            "description": "Map layers from AutoNavi / Gaode (高德地图)",
            "filename": "basemap-gaode.user.js",
            "icon": "https://iitc.app/extras/plugin-icons/basemap-gaode.png",
            "icon64": "https://iitc.app/extras/plugin-icons/basemap-gaode-64.png",
            "id": "basemap-gaode",
            "name": "Gaode (高德地图) / AutoNavi map",
            "namespace": "https://github.com/IITC-CE/ingress-intel-total-conversion",
            "status": "on",
            "uid": "Gaode (高德地图) / AutoNavi map+https://github.com/IITC-CE/ingress-intel-total-conversion",
            "version": "0.1.1"
        },
        "tab_id": 1403434310
    }
}));

This broke the plugin because the uid field of this snippet contained non-latin Chinese characters.