Ignore blank tags when saving from translator

Instead of throwing an error
This commit is contained in:
Dan Stillman 2021-12-19 03:01:17 -05:00
parent f734e53ed9
commit abe8c39c5b
2 changed files with 6 additions and 1 deletions

View file

@ -979,6 +979,9 @@ Zotero.Translate.ItemSaver.prototype = {
if (typeof tag == 'string') { if (typeof tag == 'string') {
tag = { tag }; tag = { tag };
} }
if (!tag.tag.trim()) {
continue;
}
tag.type = this._forceTagType || tag.type || 0; tag.type = this._forceTagType || tag.type || 0;
newTags.push(tag); newTags.push(tag);
} }

View file

@ -59,7 +59,9 @@ const TEST_TAGS = [
{"tag":"manual tag as object"}, {"tag":"manual tag as object"},
{"tag":"manual tag as object with type", "type":0}, {"tag":"manual tag as object with type", "type":0},
{"tag":"automatic tag as object", "type":1}, {"tag":"automatic tag as object", "type":1},
{"name":"tag in name property"} {"name":"tag in name property"},
{ name: "" },
{ name: " " },
]; ];
/** /**