From 1477893a84add7bb10f2c7b11c0192ee50b806b4 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Wed, 4 Apr 2012 23:00:24 -0500 Subject: [PATCH 1/2] Don't allow periods and commas at the end of DOIs --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index d94c55eb3e..5b71866a18 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -262,7 +262,7 @@ Zotero.Utilities = { throw "cleanDOI: argument must be a string"; } - return x.match(/10\.[^\s\/]+\/[^\s]+/); + return x.match(/10\.[^\s\/]+\/[^\s]*[^\s\.,]/); }, /** From 662ab87d7e5f1a1e783866f00f5b8bb5fd73e135 Mon Sep 17 00:00:00 2001 From: aurimasv Date: Thu, 5 Apr 2012 01:57:22 -0500 Subject: [PATCH 2/2] Require at least 4 digits for the prefix --- chrome/content/zotero/xpcom/utilities.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 5b71866a18..c9af5ba1b7 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -262,7 +262,7 @@ Zotero.Utilities = { throw "cleanDOI: argument must be a string"; } - return x.match(/10\.[^\s\/]+\/[^\s]*[^\s\.,]/); + return x.match(/10\.[0-9]{4,}\/[^\s]*[^\s\.,]/); }, /**