From 6a20d690e05170ac11762cadb6299040eb2c37d2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 25 Oct 2008 02:47:47 +0000 Subject: [PATCH] Fix errors adding tags with leading or trailing spaces to items (since yesterday) --- chrome/content/zotero/xpcom/data/item.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index e644bc293c..9a59714380 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -2689,6 +2689,8 @@ Zotero.Item.prototype.addTag = function(name, type) { throw ('Cannot add tag to unsaved item in Item.addTag()'); } + name = Zotero.Utilities.prototype.trim(name); + if (!name) { Zotero.debug('Not saving empty tag in Item.addTag()', 2); return false; @@ -2836,6 +2838,8 @@ Zotero.Item.prototype.replaceTag = function(oldTagID, newTag) { throw ('Cannot replace tag on unsaved item'); } + newTag = Zotero.Utilities.prototype.trim(newTag); + if (!newTag) { Zotero.debug('Not replacing with empty tag', 2); return false;