diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index e644bc293..9a5971438 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;