diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml
index 0862e755fa..104b3901e8 100644
--- a/chrome/content/zotero/bindings/itembox.xml
+++ b/chrome/content/zotero/bindings/itembox.xml
@@ -265,7 +265,7 @@
var doi = this.item.getField('DOI');
if (doi) {
// Pull out DOI, in case there's a prefix
- doi = doi.match(/10\..*/);
+ doi = Zotero.Utilities.prototype.cleanDOI(doi);;
if (doi) {
spec = "http://dx.doi.org/" + encodeURIComponent(doi);
}
@@ -454,7 +454,7 @@
}
else if (fieldName == 'DOI' && val) {
// Pull out DOI, in case there's a prefix
- var doi = val.match(/10\..*/);
+ var doi = Zotero.Utilities.prototype.cleanDOI(val);
if (doi) {
doi = "http://dx.doi.org/" + encodeURIComponent(doi);
label.setAttribute("isButton", true);
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
index 2a1cae6d7e..6f557dff90 100644
--- a/chrome/content/zotero/overlay.js
+++ b/chrome/content/zotero/overlay.js
@@ -1962,7 +1962,7 @@ var ZoteroPane = new function()
var doi = item.getField('DOI');
if (doi) {
// Pull out DOI, in case there's a prefix
- doi = doi.match(/10\..*/);
+ doi = Zotero.Utilities.prototype.cleanDOI(doi);
if (doi) {
uri = "http://dx.doi.org/" + encodeURIComponent(doi);
}
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js
index 1d5b7cd6e6..3a55a4daae 100644
--- a/chrome/content/zotero/xpcom/utilities.js
+++ b/chrome/content/zotero/xpcom/utilities.js
@@ -143,6 +143,16 @@ Zotero.Utilities.prototype.cleanTags = function(/**String*/ x) {
return x.replace(/<[^>]+>/g, "");
}
+
+Zotero.Utilities.prototype.cleanDOI = function(/**String**/ x) {
+ if(typeof(x) != "string") {
+ throw "cleanDOI: argument must be a string";
+ }
+
+ return x.match(/10\.[^\s\/]+\/[^\s]+/);
+}
+
+
/**
* Encode special XML/HTML characters
*