Don't include 'filename' in linked_file attachment JSON

This commit is contained in:
Dan Stillman 2016-03-24 22:26:50 -04:00
parent fc6c113f25
commit c5702abb7b
2 changed files with 10 additions and 1 deletions

View file

@ -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;
}

View file

@ -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 () {