From e935001586dffafc35e2db76d89fee52d6c879bd Mon Sep 17 00:00:00 2001 From: bwiernik Date: Tue, 7 Nov 2017 22:48:12 +0100 Subject: [PATCH] Support short DOIs in cleanDOI() and update DOI copyAsURL prefix (#1356) --- chrome/content/zotero/bindings/itembox.xml | 2 +- chrome/content/zotero/xpcom/utilities.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 2e1aa5e86..86e1f6c70 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -427,7 +427,7 @@ // Pull out DOI, in case there's a prefix var doi = Zotero.Utilities.cleanDOI(val); if (doi) { - doi = "http://dx.doi.org/" + encodeURIComponent(doi); + doi = "https://doi.org/" + encodeURIComponent(doi); label.classList.add("pointer"); label.setAttribute("onclick", "ZoteroPane_Local.loadURI('" + doi + "', event)"); label.setAttribute("tooltiptext", Zotero.getString('locate.online.tooltip')); diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 09977a759..d80445f34 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -311,7 +311,7 @@ Zotero.Utilities = { throw "cleanDOI: argument must be a string"; } - var doi = x.match(/10\.[0-9]{4,}\/[^\s]*[^\s\.,]/); + var doi = x.match(/10(?:\.[0-9]{4,})?\/[^\s]*[^\s\.,]/); return doi ? doi[0] : null; },