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.
This commit is contained in:
Dan Stillman 2026-08-19 15:36:19 -04:00
parent cdb13af13b
commit f5a2985a34

View file

@ -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;
}