From 33af51c7a1c7643e42e461985d74df64e9c59b4f Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 19 Aug 2026 15:36:19 -0400 Subject: [PATCH] Handle unparseable paths in getClosestDirectory() On Windows, stat rejects a POSIX-style path with NS_ERROR_FILE_UNRECOGNIZED_PATH rather than a not-found error. (cherry picked from commit f5a2985a3456ab2bb571b0c4a6efa1b970874200) --- chrome/content/zotero/xpcom/file.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index fdd8f03c54..beb91be86e 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -103,6 +103,11 @@ Zotero.File = new function () { } catch (e) { if (e.becauseNoSuchFile) {} + // A path that can't be parsed (e.g., a POSIX-style path on Windows) doesn't + // exist either + else if (e.message?.includes('NS_ERROR_FILE_UNRECOGNIZED_PATH')) { + return false; + } else { throw e; }