Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(api): skip video metadata update when no fields provided

Richie McIlroy13ab388e16a0
diff --git a/apps/web/app/api/upload/[...route]/signed.ts b/apps/web/app/api/upload/[...route]/signed.ts
index 255dd8a12..7e30a8ff2 100644
--- a/apps/web/app/api/upload/[...route]/signed.ts
+++ b/apps/web/app/api/upload/[...route]/signed.ts
@@ -180,17 +180,23 @@ app.post(
if (videoIdToUse) {
const videoId = Video.VideoId.make(videoIdToUse);
- await db()
- .update(Db.videos)
- .set({
- duration: updateIfDefined(durationInSecs, Db.videos.duration),
- width: updateIfDefined(width, Db.videos.width),
- height: updateIfDefined(height, Db.videos.height),
- fps: updateIfDefined(fps, Db.videos.fps),
- })
- .where(
- and(eq(Db.videos.id, videoId), eq(Db.videos.ownerId, user.id)),
- );
+ if (
+ durationInSecs !== undefined ||
+ width !== undefined ||
+ height !== undefined ||
+ fps !== undefined
+ )
+ await db()
+ .update(Db.videos)
+ .set({
+ duration: updateIfDefined(durationInSecs, Db.videos.duration),
+ width: updateIfDefined(width, Db.videos.width),
+ height: updateIfDefined(height, Db.videos.height),
+ fps: updateIfDefined(fps, Db.videos.fps),
+ })
+ .where(
+ and(eq(Db.videos.id, videoId), eq(Db.videos.ownerId, user.id)),
+ );
const clientSupportsUploadProgress = isFromDesktopSemver(
c.req,