Fix errors adding tags with leading or trailing spaces to items (since yesterday)

This commit is contained in:
Dan Stillman 2008-10-25 02:47:47 +00:00
parent 7a6656ae5c
commit 6a20d690e0

View file

@ -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;