From e35c220be46ec3e50d367e757de4e085a676190d Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 23 Sep 2024 11:41:14 +0100 Subject: [PATCH] Ignore IOUtils.exists() error when auto-relinking Should fix #4701 --- chrome/content/zotero/zoteroPane.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index bfbe69c199..25d173dd77 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -5845,9 +5845,20 @@ var ZoteroPane = new function() for (let segmentsToDrop = 0; segmentsToDrop < parts.length; segmentsToDrop++) { let correctedPath = join(basePath, ...parts.slice(segmentsToDrop)); - if (!(await IOUtils.exists(correctedPath))) { - Zotero.debug('Does not exist: ' + correctedPath); - continue; + try { + if (!(await IOUtils.exists(correctedPath))) { + Zotero.debug('Does not exist: ' + correctedPath); + continue; + } + } + catch (e) { + // IOUtils.exists() throws if the path is invalid - suppress that + if (e.name === 'NS_ERROR_FILE_UNRECOGNIZED_PATH') { + Zotero.debug('Invalid path: ' + correctedPath); + continue; + } + // Otherwise this could be a meaningful filesystem error, so re-throw + throw e; } Zotero.debug('Exists! ' + correctedPath);