diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index ba7bfe1004..5e7fb25242 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -995,6 +995,10 @@ Zotero.Utilities.Internal = { let [_, originalField, value] = parts; let key = this._normalizeExtraKey(originalField); value = value.trim(); + // Skip empty values + if (value === "") { + return [null, null]; + } return [key, value]; }; diff --git a/test/tests/utilities_internalTest.js b/test/tests/utilities_internalTest.js index 0431dd1b6b..6bdf4798d3 100644 --- a/test/tests/utilities_internalTest.js +++ b/test/tests/utilities_internalTest.js @@ -266,6 +266,13 @@ describe("Zotero.Utilities.Internal", function () { assert.strictEqual(extra, ''); }); + it("should ignore empty creator in citeproc-js cheater syntax", function () { + var str = '{:author: }\n'; + var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str); + assert.equal(fields.size, 0); + assert.strictEqual(extra, str); + }); + it("should ignore both Event Place and Publisher Place (temporary)", function () { var str = "Event Place: Foo\nPublisher Place: Bar"; var { fields, extra } = Zotero.Utilities.Internal.extractExtraFields(str);