Better approach to opening files after on-demand downloads

Follow-up to 44507ce20b
This commit is contained in:
Dan Stillman 2017-05-11 01:25:39 -04:00
parent b3acb12973
commit 9de6a55bce

View file

@ -4117,9 +4117,8 @@ var ZoteroPane = new function()
return;
}
let downloadedItem = item;
try {
yield Zotero.Sync.Runner.downloadFile(downloadedItem);
yield Zotero.Sync.Runner.downloadFile(item);
}
catch (e) {
// TODO: show error somewhere else
@ -4128,10 +4127,8 @@ var ZoteroPane = new function()
return;
}
if (!(yield downloadedItem.getFilePathAsync())) {
ZoteroPane_Local.showAttachmentNotFoundDialog(
downloadedItem.id, noLocateOnMissing, true
);
if (!(yield item.getFilePathAsync())) {
ZoteroPane_Local.showAttachmentNotFoundDialog(item.id, noLocateOnMissing, true);
return;
}
@ -4139,9 +4136,8 @@ var ZoteroPane = new function()
// maybe not necessary, since we'll get an error if there's an error
Zotero.Notifier.trigger('redraw', 'item', []);
setTimeout(() => {
ZoteroPane_Local.viewAttachment(downloadedItem.id, event, false, forceExternalViewer);
});
// Retry after download
i--;
}
}
}));