Don't URL-encode most characters in DOIs when opening/copying as link

Only #, ?, and % are now encoded.

Addresses #295
This commit is contained in:
Dan Stillman 2019-06-10 14:55:28 -04:00
parent 98d2b69020
commit 782c2a1d15

View file

@ -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'));