Skip to content

Write HTML. Render video. Built for agents.

fix: escape NUL bytes in HFMASK regex (Bun blank renders) + Windows junction for studio preview links (#2140)

Miguel Ángel718c67b387a0
diff --git a/packages/cli/src/commands/preview.ts b/packages/cli/src/commands/preview.ts
index 598d6e92e9..6edeec423a 100644
--- a/packages/cli/src/commands/preview.ts
+++ b/packages/cli/src/commands/preview.ts
@@ -682,7 +682,9 @@ function linkProjectIntoStudioData(
}
}
if (!existsSync(symlinkPath)) {
- symlinkSync(dir, symlinkPath, "dir");
+ // Windows: "dir" symlinks need Developer Mode or elevation (EPERM otherwise);
+ // NTFS junctions are unprivileged and keep the live write-back the studio needs.
+ symlinkSync(dir, symlinkPath, process.platform === "win32" ? "junction" : "dir");
createdSymlink = true;
}
}
diff --git a/packages/core/src/compiler/timingCompiler.test.ts b/packages/core/src/compiler/timingCompiler.test.ts
index 86e7dfe7ce..cab293ebbd 100644
--- a/packages/core/src/compiler/timingCompiler.test.ts
+++ b/packages/core/src/compiler/timingCompiler.test.ts
@@ -1,3 +1,5 @@
+import { readFileSync } from "node:fs";
+import { dirname, join } from "node:path";
import { describe, it, expect } from "vitest";
import {
compileTimingAttrs,
@@ -6,6 +8,15 @@ import {
clampDurations,
} from "./timingCompiler.js";
+// Raw 0x00 bytes in the HFMASK delimiters shipped once and broke every render
+// under Bun's transpiler while behaving fine under Node (issue #2139) — only a
+// byte-level check catches that, so keep the delimiters as \x00 escapes.
+it("source contains no raw NUL bytes", () => {
+ const testPath = expect.getState().testPath ?? "";
+ const src = readFileSync(join(dirname(testPath), "timingCompiler.ts"), "latin1");
+ expect(src.includes("\x00")).toBe(false);
+});
+
describe("compileTimingAttrs", () => {
it("adds data-end when data-start and data-duration are present on a video", () => {
const html = '<video id="v1" src="a.mp4" data-start="2" data-duration="5">';
diff --git a/packages/core/src/compiler/timingCompiler.ts b/packages/core/src/compiler/timingCompiler.ts
index eb55a112a8..b5c3a06feb 100644
Binary files a/packages/core/src/compiler/timingCompiler.ts and b/packages/core/src/compiler/timingCompiler.ts differ