Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Merge branch 'main' into fix/video-duplicate-properties

Richie McIlroy39d3918554ee
diff --cc apps/web/__tests__/unit/recording-storage-lifecycle.test.ts
index b638e3f62,45896b27b..ee7e21f39
--- a/apps/web/__tests__/unit/recording-storage-lifecycle.test.ts
+++ b/apps/web/__tests__/unit/recording-storage-lifecycle.test.ts
@@@ -905,33 -921,28 +928,54 @@@ describe("recording storage lifecycle"
},
]);
});
+ it("duplicates enhanced browser playback without retaining foreign audio pointers", async () => {
+ const audioKey = `${prefix}.recording/outputs/audio-quality-v3/selected.mp4`;
+ const database = databaseFixture(
+ recording({
+ type: "webMP4",
+ audioLevelSourceKey: `${prefix}result.mp4`,
+ audioLevelOutputKey: audioKey,
+ }),
+ );
+ const storage = await storageFixture([
+ [audioKey, "enhanced"],
+ [`${prefix}result.mp4`, "original"],
+ ]);
+ const result = await runVideoOperation("duplicate");
+ expect(Exit.isSuccess(result)).toBe(true);
+ expect(storage.objects.get(`${newPrefix}result.mp4`)).toBe("enhanced");
+ expect(database.rows.get("duplicate-video")?.source).toEqual({
+ type: "webMP4",
+ });
+ expect(storage.objects.get(`${prefix}result.mp4`)).toBe("original");
+ });
+ it("preserves password and strips customCreatedAt without copying original createdAt or updatedAt", async () => {
+ const videoWithCustomDate = Video.Video.make({
+ ...recording(),
+ metadata: Option.some({
+ sourceName: "Dated recording",
+ customCreatedAt: "2020-01-01T00:00:00.000Z",
+ }),
+ });
+ const database = databaseFixture(videoWithCustomDate, "secret-pass-123");
+ await storageFixture([
+ [outputKey, "verified-video"],
+ [thumbnailKey, "verified-thumbnail"],
+ [previewKey, "verified-preview"],
+ ]);
+ const result = await runVideoOperation("duplicate");
+ expect(Exit.isSuccess(result)).toBe(true);
+ const duplicated = database.rows.get("duplicate-video");
+ expect(duplicated).toBeDefined();
+ expect(duplicated).not.toHaveProperty("createdAt");
+ expect(duplicated).not.toHaveProperty("updatedAt");
+ expect(duplicated?.metadata).not.toHaveProperty("customCreatedAt");
+ expect(duplicated).toMatchObject({
+ password: "secret-pass-123",
+ });
+ });
+
it("does not duplicate source inventories, raw fragments, or comment attachments across pages", async () => {
const database = databaseFixture();
const retained = Array.from(
diff --cc packages/web-backend/src/Videos/index.ts
index 54501bcb4,1b15fa49e..0a7bb1347
--- a/packages/web-backend/src/Videos/index.ts
+++ b/packages/web-backend/src/Videos/index.ts
@@@ -410,15 -413,18 +413,22 @@@ export class Videos extends Effect.Serv
}
} while (continuationToken);
publicationAttempted = true;
+ const hasPassword = Option.isSome(password);
yield* repo.create(
{
- ...video,
+ ownerId: video.ownerId,
+ orgId: video.orgId,
+ name: video.name,
+ public: video.public,
source:
- publishedKeys.size > 0 ? { type: "desktopMP4" } : video.source,
+ publishedKeys.size > 0
+ ? {
+ type:
+ video.source.type === "webMP4"
+ ? "webMP4"
+ : "desktopMP4",
+ }
+ : video.source,
metadata: Option.map(video.metadata, (metadata) => {
const copied = { ...metadata };
delete copied.desktopRecordingUpload;