Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/studio-server/src/helpers/proxyCacheKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function boxPart(box: PreviewProxyBox | undefined): string {
return box ? formatPreviewProxyBox(box) : "";
}

/** Where a source sits and when it last changed: a hit needs no reading of the file. */
/** Where a source sits and when it last changed, by change time too, which no copy keeps: a hit reads no bytes. */
export async function fastCopyKey(
sourcePath: string,
version: string,
Expand All @@ -27,6 +27,7 @@ export async function fastCopyKey(
return digest(
sourcePath,
String(stat.mtimeMs),
String(stat.ctimeMs),
String(stat.size),
version,
variant,
Expand Down
18 changes: 18 additions & 0 deletions packages/studio-server/src/helpers/proxyTranscoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,24 @@ describe("resolveProxy", () => {
expect(calls).toHaveLength(2);
});

it("makes a new copy for a file of the same size copied over with its modified time kept", async () => {
const { spawn, calls } = createSpawnSpy();
const env = await loadModule(spawn, FFMPEG_PATH);
const projectDir = tmpProject();
const sourcePath = join(projectDir, "clip.mov");
const pinned = new Date("2026-01-01T00:00:00Z");
writeFileSync(sourcePath, "first clip");
utimesSync(sourcePath, pinned, pinned);
const first = await made(env, calls, projectDir, sourcePath);

writeFileSync(sourcePath, "other clip");
utimesSync(sourcePath, pinned, pinned);
const second = await made(env, calls, projectDir, sourcePath);

expect(second).not.toBe(first);
expect(calls).toHaveLength(2);
});

it("makes a new copy when a link is retargeted to other bytes", async () => {
const { spawn, calls } = createSpawnSpy();
const env = await loadModule(spawn, FFMPEG_PATH);
Expand Down
Loading