www

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

commit d904470200bb3ead270db8d3baa7392ee48810ec
parent 7107be3cdd062fbda799b7564c109832556810f0
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat, 14 Mar 2009 21:48:47 +0000

Fixes #1393, "Error when adding existing tag beginning with certain extended characters to an item", but not properly

SQLite's COLLATE NOCASE doesn't work for Unicode characters, so it won't find existing tag "Äbc" if "äbc" is entered and will allow a duplicate tag to be created


Diffstat:
Mchrome/content/zotero/xpcom/data/tags.js | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js @@ -74,12 +74,16 @@ Zotero.Tags = new function() { * Returns the tagID matching given tag and type */ function getID(name, type) { - name = Zotero.Utilities.prototype.trim(name).toLowerCase(); + name = Zotero.Utilities.prototype.trim(name); + var lcname = name.toLowerCase(); - if (_tags[type] && _tags[type]['_' + name]) { - return _tags[type]['_' + name]; + if (_tags[type] && _tags[type]['_' + lcname]) { + return _tags[type]['_' + lcname]; } + // FIXME: COLLATE NOCASE doesn't work for Unicode characters, so this + // won't find Äbc if "äbc" is entered and will allow a duplicate tag + // to be created var sql = 'SELECT tagID FROM tags WHERE name=? AND type=?'; var tagID = Zotero.DB.valueQuery(sql, [name, type]); @@ -87,7 +91,7 @@ Zotero.Tags = new function() { if (!_tags[type]) { _tags[type] = []; } - _tags[type]['_' + name] = tagID; + _tags[type]['_' + lcname] = tagID; } return tagID;