From f7f55f05adedc8309a3a27840ff70a8eb421ab5a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 10 Jun 2019 17:06:59 -0400 Subject: [PATCH] Percent-encode " character in DOIs when opening/copying as link I'm not sure a double-quote actually appears in any DOIs, but it's technically valid and would result in an invalid URL. Follow-up to 782c2a1d1 Addresses #295 --- chrome/content/zotero/bindings/itembox.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 081e04e5e8..f51abb9b40 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -429,10 +429,12 @@ var doi = Zotero.Utilities.cleanDOI(val); if (doi) { doi = "https://doi.org/" - // Encode some characters. '/' doesn't need to be encoded + // Encode some characters that are technically valid in DOIs, + // though generally not used. '/' doesn't need to be encoded. + doi.replace(/#/g, '%23') .replace(/\?/g, '%3f') - .replace(/%/g, '%25'); + .replace(/%/g, '%25') + .replace(/"/g, '%22'); label.classList.add("pointer"); label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip'));