diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index bbb5ebaf6..9216d90e8 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -4093,7 +4093,7 @@ Zotero.Item.prototype.toJSON = function (options = {}) { if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE) { obj.path = this.attachmentPath; } - else { + else if (linkMode != Zotero.Attachments.LINK_MODE_LINKED_URL) { obj.filename = this.attachmentFilename; } diff --git a/test/tests/itemTest.js b/test/tests/itemTest.js index 1a05fcbd5..a5a327ce0 100644 --- a/test/tests/itemTest.js +++ b/test/tests/itemTest.js @@ -986,6 +986,15 @@ describe("Zotero.Item", function () { assert.isNull(json.mtime); assert.isNull(json.md5); }) + + it("shouldn't include filename or path for linked_url attachments", function* () { + var item = new Zotero.Item('attachment'); + item.attachmentLinkMode = 'linked_url'; + item.url = "https://www.zotero.org/"; + var json = item.toJSON(); + assert.notProperty(json, "filename"); + assert.notProperty(json, "path"); + }); }) describe("'full' mode", function () {