Always await callback in ZoteroPane.viewAttachment()

The recent change to sniff for PDFs when an attachment didn't have a
content type resulted in a ZoteroPane test failing, because a stub for
Zotero.launchFile() wouldn't be called by the time the viewAttachment()
promise resolved.
This commit is contained in:
Dan Stillman 2020-12-28 00:19:23 -05:00
parent 1f2408a9c5
commit c73f51faef

View file

@ -4206,7 +4206,7 @@ var ZoteroPane = new function()
if (fileExists && !redownload) {
Zotero.debug("Opening " + path);
Zotero.Notifier.trigger('open', 'file', item.id);
launchFile(path, item.attachmentContentType, item.id);
await launchFile(path, item.attachmentContentType, item.id);
continue;
}
@ -4252,7 +4252,7 @@ var ZoteroPane = new function()
Zotero.debug("Opening " + path);
Zotero.Notifier.trigger('open', 'file', item.id);
launchFile(path, item.attachmentContentType, item.id);
await launchFile(path, item.attachmentContentType, item.id);
}
});