Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(studio-server): the public proxy cache path names boxed preview copies too (#5407)
Miguel Ángele158c73a9eb1
diff --git a/packages/studio-server/src/helpers/proxyTranscoder.test.ts b/packages/studio-server/src/helpers/proxyTranscoder.test.tsindex 3e0007b51e..4a258c41e3 100644--- a/packages/studio-server/src/helpers/proxyTranscoder.test.ts+++ b/packages/studio-server/src/helpers/proxyTranscoder.test.ts@@ -192,6 +192,23 @@ describe("resolveProxy", () => {expect(cacheDirEntries).toEqual([expectedCachePath.split("/").at(-1)]);});+ it("names the boxed preview copy resolveProxy writes when given the same box", async () => {+ const { spawn, calls } = createSpawnSpy();+ const { resolveProxy, getProxyCachePath } = await loadModule(spawn, FFMPEG_PATH);+ const projectDir = tmpProject();+ const sourcePath = join(projectDir, "clip.mov");+ writeFileSync(sourcePath, "source-bytes");+ const box = { width: 1024, height: 724 };++ const boxedPath = getProxyCachePath(projectDir, sourcePath, "h264", box);+ const resultPromise = resolveProxy(projectDir, sourcePath, "h264", box);+ await flush();+ succeed(calls[0]!);++ expect(await resultPromise).toBe(boxedPath);+ expect(boxedPath).not.toBe(getProxyCachePath(projectDir, sourcePath, "h264"));+ });+it("uses Chromium-compatible VP8 alpha args and a distinct WebM cache path", async () => {const { spawn, calls } = createSpawnSpy();const { resolveProxy, getProxyCachePath } = await loadModule(spawn, FFMPEG_PATH);diff --git a/packages/studio-server/src/helpers/proxyTranscoder.ts b/packages/studio-server/src/helpers/proxyTranscoder.tsindex 110cbe907a..5e866f68fe 100644--- a/packages/studio-server/src/helpers/proxyTranscoder.ts+++ b/packages/studio-server/src/helpers/proxyTranscoder.ts@@ -201,17 +201,19 @@ function getCanonicalProxyCachePath(/*** Computes the absolute path a proxy for this source would live at, without- * transcoding anything. Route handlers use this to check cache state (e.g.- * for ETag/If-None-Match) before deciding whether to await a transcode.+ * transcoding anything, so a host can check cache state. Pass the request's+ * preview box (`hf-proxy-box`) to name a boxed copy.*/export function getProxyCachePath(projectDir: string,absoluteSourcePath: string,variant: ProxyVariant = "h264",+ box?: PreviewProxyBox,): string {return getCanonicalProxyCachePath(canonicalizeProxySource(projectDir, absoluteSourcePath),variant,+ box,);}