diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index fd8e6a7c9c..14462e4e23 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -979,6 +979,9 @@ Zotero.Translate.ItemSaver.prototype = { if (typeof tag == 'string') { tag = { tag }; } + if (!tag.tag.trim()) { + continue; + } tag.type = this._forceTagType || tag.type || 0; newTags.push(tag); } diff --git a/test/tests/translateTest.js b/test/tests/translateTest.js index ea83ab985a..3078cd66b9 100644 --- a/test/tests/translateTest.js +++ b/test/tests/translateTest.js @@ -59,7 +59,9 @@ const TEST_TAGS = [ {"tag":"manual tag as object"}, {"tag":"manual tag as object with type", "type":0}, {"tag":"automatic tag as object", "type":1}, - {"name":"tag in name property"} + {"name":"tag in name property"}, + { name: "" }, + { name: " " }, ]; /**