commit b2ee954c5dc4ea7dd947d0257f6ccc679e681d07
parent 2af8faaf85b21cd7b17f06408fa3add4aaabfd8a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 11 Nov 2026 06:19:00 -0500
local media: an import writes external-media.json through its sidecar
The commit primitive staged the reference with a raw writeFile while the
link path used the declared sidecar writer; both now go through
writeExternalMediaReference (lib/externalMedia-server.ts), which validates
the reference before writing. The hard-link publication is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/lib/localMediaCommit-server.ts b/common/lib/localMediaCommit-server.ts
@@ -2,6 +2,7 @@ import { requireLocalRecordingMetadata } from "./localRecordingMetadata";
import path from "node:path";
import { link, lstat, mkdir, mkdtemp, realpath, rm, writeFile } from "node:fs/promises";
import { coerceExternalMediaReference, EXTERNAL_MEDIA_FILENAME } from "./localMedia";
+import { writeExternalMediaReference } from "./externalMedia-server";
import { extractVideoId } from "./videoId";
import { parseVtt } from "./vtt";
@@ -83,7 +84,9 @@ export async function commitLocalMediaRecord(options: {
// metadata/transcript again. Bytes supplied by the controller are retained.
await writeFile(path.join(stage, "metadata.info.json"), metadata, { flag: "wx" });
await writeFile(path.join(stage, "transcript.en.vtt"), transcript, { flag: "wx" });
- await writeFile(path.join(stage, EXTERNAL_MEDIA_FILENAME), JSON.stringify(reference, null, 2) + "\n", { flag: "wx" });
+ // The declared sidecar's writer (lib/externalMedia-server.ts), into the
+ // private staging dir; the hard link below publishes it.
+ await writeExternalMediaReference(stage, reference);
signal?.throwIfAborted();
try { await mkdir(target); reserved = true; }
catch (error) {