Tsuk1ko / nhentai-helper

🔞 A user script make it easy for you to download nHentai manga as zip (or cbz), also support some mirror sites. 一个可以让你轻松打包下载 nHentai 本子的用户脚本,并支持一些镜像站
https://greasyfork.org/scripts/375992
GNU General Public License v3.0
585 stars 45 forks source link

crash while metadata contains "&" #40

Closed finalparanoia closed 1 year ago

finalparanoia commented 1 year ago

& is illegal in xml context and will crash the process.

crash in line 41534

el.innerHTML = String(value);

mitigation measures can be the code as follow:

      if (!isNil(value)) {
        let regex = /^.*\&.*$/
        if (regex.test(value)) {
          value = value.replace(/\&/, " and ")
          el.innerHTML = String(value);
        } else {
          el.innerHTML = String(value);
        }
      }

expected formal fix of the program

zh-cn:

&在xml中会被错误的转义,通过添加一些判断可以缓解这一错误,临时缓解代码如上,期待正式的修复。