From b2263e752f563f44f4828a6a91f12b12fa51bca0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 01:14:56 +0000 Subject: [PATCH] Cover safe in-dist symlink static resolution Co-authored-by: Theo Browne --- apps/t3/src/cli.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/t3/src/cli.test.ts b/apps/t3/src/cli.test.ts index 671d9cbc36..eadb898280 100644 --- a/apps/t3/src/cli.test.ts +++ b/apps/t3/src/cli.test.ts @@ -483,6 +483,21 @@ describe("resolveStaticAssetReadTarget", () => { }); }); + it("allows symlinked files that resolve inside dist directory", () => { + const tempDir = mkdtempSync(path.join(os.tmpdir(), "t3-static-symlink-inside-")); + const assetsDir = path.join(tempDir, "assets"); + mkdirSync(assetsDir, { recursive: true }); + writeFileSync(path.join(tempDir, "index.html"), "ok", "utf8"); + writeFileSync(path.join(assetsDir, "main.js"), "console.log('ok')", "utf8"); + symlinkSync(path.join(assetsDir, "main.js"), path.join(tempDir, "linked-main.js")); + + const result = resolveStaticAssetReadTarget("/linked-main.js", tempDir); + expect(result).toEqual({ + kind: "file", + filePath: path.join(assetsDir, "main.js"), + }); + }); + it("returns not_found when spa fallback file is missing", () => { const tempDir = mkdtempSync(path.join(os.tmpdir(), "t3-static-missing-index-")); const result = resolveStaticAssetReadTarget("/missing.js", tempDir);