commit 99f9bcb79da8920ca0c674e0cc230f0c2f4a1a46
parent 6a20d690e05170ac11762cadb6299040eb2c37d2
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 25 Oct 2008 03:10:50 +0000
More tag/space handling
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/data/tags.js b/chrome/content/zotero/xpcom/data/tags.js
@@ -75,7 +75,7 @@ Zotero.Tags = new function() {
* Returns the tagID matching given tag and type
*/
function getID(name, type) {
- name = name.toLowerCase();
+ name = Zotero.Utilities.prototype.trim(name).toLowerCase();
if (_tags[type] && _tags[type]['_' + name]) {
return _tags[type]['_' + name];
@@ -99,6 +99,7 @@ Zotero.Tags = new function() {
* Returns all tagIDs for this tag (of all types)
*/
function getIDs(name) {
+ name = Zotero.Utilities.prototype.trim(name);
var sql = 'SELECT tagID FROM tags WHERE name=?';
return Zotero.DB.columnQuery(sql, [name]);
}
@@ -108,6 +109,7 @@ Zotero.Tags = new function() {
* Returns an array of tag types for tags matching given tag
*/
function getTypes(name) {
+ name = Zotero.Utilities.prototype.trim(name);
var sql = 'SELECT type FROM tags WHERE name=?';
return Zotero.DB.columnQuery(sql, [name]);
}
@@ -238,6 +240,8 @@ Zotero.Tags = new function() {
function rename(tagID, name) {
Zotero.debug('Renaming tag', 4);
+ name = Zotero.Utilities.prototype.trim(name);
+
Zotero.DB.beginTransaction();
var tagObj = this.get(tagID);