From 7fa7a635d4c63c1ab109217fe8ff8c42a5045199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20Andr=C3=A9?= Date: Sat, 25 Apr 2026 18:18:05 +0200 Subject: [PATCH] fix(filesystem): tolerate unresolved paths --- packages/core/src/filesystem.ts | 5 ++--- packages/core/test/filesystem/filesystem.test.ts | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/filesystem.ts b/packages/core/src/filesystem.ts index 44346be8f942..10da54fcc2e2 100644 --- a/packages/core/src/filesystem.ts +++ b/packages/core/src/filesystem.ts @@ -209,9 +209,8 @@ export namespace AppFileSystem { const resolved = pathResolve(windowsPath(p)) try { return normalizePath(realpathSync(resolved)) - } catch (e: any) { - if (e?.code === "ENOENT") return normalizePath(resolved) - throw e + } catch { + return normalizePath(resolved) } } diff --git a/packages/core/test/filesystem/filesystem.test.ts b/packages/core/test/filesystem/filesystem.test.ts index b77f4e356fa0..a36e38491cf4 100644 --- a/packages/core/test/filesystem/filesystem.test.ts +++ b/packages/core/test/filesystem/filesystem.test.ts @@ -324,6 +324,10 @@ describe("AppFileSystem", () => { expect(AppFileSystem.mimeType("unknown.qzx")).toBe("application/octet-stream") }) + test("resolve tolerates missing paths", () => { + expect(() => AppFileSystem.resolve(path.join("definitely-missing", crypto.randomUUID()))).not.toThrow() + }) + test("contains checks path containment", () => { expect(AppFileSystem.contains("/a/b", "/a/b/c")).toBe(true) expect(AppFileSystem.contains("/a/b", "/a/c")).toBe(false)