Ignore IOUtils.exists() error when auto-relinking

Should fix #4701
This commit is contained in:
Abe Jellinek 2024-09-23 11:41:14 +01:00
parent d4b2fbf33b
commit e35c220be4

View file

@ -5845,10 +5845,21 @@ var ZoteroPane = new function()
for (let segmentsToDrop = 0; segmentsToDrop < parts.length; segmentsToDrop++) {
let correctedPath = join(basePath, ...parts.slice(segmentsToDrop));
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);
if (Zotero.isWin) {