From 7b6e19435b348fed4ffa2a6e854a9b00ea80fe79 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Wed, 6 Jul 2022 22:20:15 +0200 Subject: [PATCH 1/5] Don't try to remove temporary dir after import Previously we had a structure that also created folders in temp dir, that has since changed but code in cleanup phase to remove containing dir has been accidentally left unremoved. --- chrome/content/zotero/import/mendeley/mendeleyImport.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/chrome/content/zotero/import/mendeley/mendeleyImport.js b/chrome/content/zotero/import/mendeley/mendeleyImport.js index d8ff6303dd..eeb7a85d71 100644 --- a/chrome/content/zotero/import/mendeley/mendeleyImport.js +++ b/chrome/content/zotero/import/mendeley/mendeleyImport.js @@ -289,10 +289,8 @@ Zotero_Import_Mendeley.prototype.translate = async function (options = {}) { }; Zotero_Import_Mendeley.prototype._removeTemporaryFile = async function (file) { - const containingDir = OS.Path.dirname(file); try { await Zotero.File.removeIfExists(file); - await OS.File.removeEmptyDir(containingDir); } catch (e) { Zotero.logError(e); From 42aebccbf448f138b573013d3ffd16f50398ee73 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Wed, 6 Jul 2022 22:47:22 +0200 Subject: [PATCH 2/5] Mendeley import: detect win close, better feedback * Detect wizard cancel/close and interrupt import. This will still have to wait for current fetch (file or metadata) to complete but will then advance to the cleanup stage * Advance progress bar during metadata fetch * Add some extra logging --- chrome/content/zotero/import/importWizard.js | 7 +- chrome/content/zotero/import/importWizard.xul | 1 + .../import/mendeley/mendeleyAPIUtils.js | 4 +- .../zotero/import/mendeley/mendeleyImport.js | 96 ++++++++++++++----- 4 files changed, 84 insertions(+), 24 deletions(-) diff --git a/chrome/content/zotero/import/importWizard.js b/chrome/content/zotero/import/importWizard.js index 3d16905b72..b8625d06f7 100644 --- a/chrome/content/zotero/import/importWizard.js +++ b/chrome/content/zotero/import/importWizard.js @@ -57,7 +57,12 @@ var Zotero_Import_Wizard = { Zotero.Translators.init(); // async }, - + + onCancel: function () { + if (this._translation && this._translation.interrupt) { + this._translation.interrupt(); + } + }, onModeChosen: async function () { var wizard = this._wizard; diff --git a/chrome/content/zotero/import/importWizard.xul b/chrome/content/zotero/import/importWizard.xul index c4eed4c818..4fc12adaf7 100644 --- a/chrome/content/zotero/import/importWizard.xul +++ b/chrome/content/zotero/import/importWizard.xul @@ -10,6 +10,7 @@ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" title="&zotero.import;" + onwizardcancel="Zotero_Import_Wizard.onCancel()" onload="Zotero_Import_Wizard.init()">