From 782c2a1d15144e2c53e8987047625a2ea3b7698e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 10 Jun 2019 14:55:28 -0400 Subject: [PATCH] Don't URL-encode most characters in DOIs when opening/copying as link Only #, ?, and % are now encoded. Addresses #295 --- chrome/content/zotero/bindings/itembox.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 56a3a06df4..081e04e5e8 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -428,7 +428,11 @@ // Pull out DOI, in case there's a prefix var doi = Zotero.Utilities.cleanDOI(val); if (doi) { - doi = "https://doi.org/" + encodeURIComponent(doi); + doi = "https://doi.org/" + // Encode some characters. '/' doesn't need to be encoded + + doi.replace(/#/g, '%23') + .replace(/\?/g, '%3f') + .replace(/%/g, '%25'); label.classList.add("pointer"); label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip'));