Download missing attachments as needed even in at-sync-time mode

This commit is contained in:
Dan Stillman 2017-08-11 16:05:02 +02:00
parent 3a2f0e6929
commit 9202ab8b3c
2 changed files with 52 additions and 50 deletions

View file

@ -4123,8 +4123,7 @@ var ZoteroPane = new function()
}
else {
if (!item.isImportedAttachment()
|| (!Zotero.Sync.Storage.Local.getEnabledForLibrary(item.libraryID)
|| !Zotero.Sync.Storage.Local.downloadAsNeeded(item.libraryID))) {
|| !Zotero.Sync.Storage.Local.getEnabledForLibrary(item.libraryID)) {
this.showAttachmentNotFoundDialog(itemID, noLocateOnMissing);
return;
}

View file

@ -177,8 +177,10 @@ describe("ZoteroPane", function() {
})
it("should download an attachment on-demand", function* () {
for (let fn of ['downloadAsNeeded', 'downloadOnSync']) {
yield setup();
Zotero.Sync.Storage.Local.downloadAsNeeded(Zotero.Libraries.userLibraryID, true);
Zotero.Sync.Storage.Local[fn](Zotero.Libraries.userLibraryID, true);
var item = new Zotero.Item("attachment");
item.attachmentLinkMode = 'imported_file';
@ -227,6 +229,7 @@ describe("ZoteroPane", function() {
assert.equal((yield item.attachmentModificationTime), mtime);
var path = yield item.getFilePathAsync();
assert.equal((yield Zotero.File.getContentsAsync(path)), text);
}
})
})