www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit beaaf8fc6b31b8471bcf13f169611b92212f7e8b
parent 5e6c90d87387d823efbaf05b90b9490b680a0822
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri,  4 Jan 2013 13:00:26 -0500

Accept two missing letters in object keys (but don't use them yet)

Also:

- 'T' doesn't come after 'X' (but does probably appear disproportionally
  in existing object keys)

This commit has been brought to you by the letters 'L' and 'Y'.

Diffstat:
Mchrome/content/zotero/xpcom/data/creator.js | 3+--
Mchrome/content/zotero/xpcom/id.js | 9++++++++-
Mchrome/content/zotero/xpcom/utilities.js | 2+-
3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/creator.js b/chrome/content/zotero/xpcom/data/creator.js @@ -536,8 +536,7 @@ Zotero.Creator.prototype._checkValue = function (field, value) { break; case 'key': - var re = /^[23456789ABCDEFGHIJKMNPQRSTUVWXTZ]{8}$/ - if (!re.test(value)) { + if (!Zotero.ID.isValidKey(value)) { this._invalidValueError(field, value); } break; diff --git a/chrome/content/zotero/xpcom/id.js b/chrome/content/zotero/xpcom/id.js @@ -87,11 +87,18 @@ Zotero.ID_Tracker = function () { function getKey() { - var baseString = "23456789ABCDEFGHIJKMNPQRSTUVWXTZ"; + // TODO: add 'L' and 'Y' after 3.0.11 cut-off + var baseString = "23456789ABCDEFGHIJKMNPQRSTUVWXZ"; return Zotero.randomString(8, baseString); } + this.isValidKey = function () { + var re = /^[23456789ABCDEFGHIJKLMNPQRSTUVWXYZ]{8}$/ + return re.test(value); + } + + function getBigInt(max) { if (!max) { max = 9007199254740991; diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -1069,7 +1069,7 @@ Zotero.Utilities = { **/ "randomString":function(len, chars) { if (!chars) { - chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; + chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghiklmnopqrstuvwxyz"; } if (!len) { len = 8;