Fix imports with missing attachments not closing progress window. Closes #1583

This commit is contained in:
Adomas Venčkauskas 2018-10-12 13:48:06 +03:00
parent 6bf31b274f
commit f7e9067660

View file

@ -196,9 +196,10 @@ Zotero.Translate.ItemSaver.prototype = {
// possible downloads.
//
// TODO: Separate pref?
var shouldDownloadOAPDF = this.attachmentMode == Zotero.Translate.ItemSaver.ATTACHMENT_MODE_DOWNLOAD
&& Zotero.Prefs.get('downloadAssociatedFiles');
var openAccessPDFURLs = new Map();
if (this.attachmentMode == Zotero.Translate.ItemSaver.ATTACHMENT_MODE_DOWNLOAD
&& Zotero.Prefs.get('downloadAssociatedFiles')) {
if (shouldDownloadOAPDF) {
for (let item of items) {
let jsonItem = jsonByItem.get(item);
@ -239,7 +240,7 @@ Zotero.Translate.ItemSaver.prototype = {
parentItemID,
function (attachment, progress, error) {
// Don't cancel failed primary PDFs until we've tried other methods
if (progress === false && attachment.isPrimaryPDF) {
if (progress === false && attachment.isPrimaryPDF && shouldDownloadOAPDF) {
return;
}
attachmentCallback(...arguments);
@ -252,8 +253,7 @@ Zotero.Translate.ItemSaver.prototype = {
// If a translated PDF attachment wasn't saved successfully, either because there wasn't
// one or there was but it failed, look for another PDF (if enabled)
if (this.attachmentMode == Zotero.Translate.ItemSaver.ATTACHMENT_MODE_DOWNLOAD
&& Zotero.Prefs.get('downloadAssociatedFiles')) {
if (shouldDownloadOAPDF) {
for (let item of items) {
// Already have a PDF from translation
if (itemIDsWithPDFAttachments.has(item.id)) {