extraToCSL(): Fix "zoteroField[1] is undefined" on single-character field

E.g., "a:" on a line

https://forums.zotero.org/discussion/82286/new-line-in-extra-field-induces-error-during-bibliography-generation
This commit is contained in:
Dan Stillman 2020-04-03 18:11:32 -04:00
parent 9919090901
commit 91ca6d2ba6
2 changed files with 6 additions and 1 deletions

View file

@ -41,5 +41,10 @@ describe("Zotero.Cite", function () {
var str2 = 'DOI: 10.0/abc';
assert.equal(Zotero.Cite.extraToCSL(str1), str2);
});
it("should handle a single-character field name", function () {
var str = 'a: ';
assert.equal(Zotero.Cite.extraToCSL(str), str);
});
});
});