Skip to content

Commit b58823c

Browse files
fixes
1 parent 3985537 commit b58823c

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

apps/desktop/src-tauri/src/upload.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ pub fn build_video_meta(path: &PathBuf) -> Result<S3VideoMeta, String> {
387387

388388
let video_codec = ffmpeg::codec::context::Context::from_parameters(video_stream.parameters())
389389
.map_err(|e| format!("Unable to read video codec information: {e}"))?;
390-
let video = video_codec.decoder().video().unwrap();
390+
let video = video_codec
391+
.decoder()
392+
.video()
393+
.map_err(|e| format!("Unable to get video decoder: {e}"))?;
391394

392395
Ok(S3VideoMeta {
393396
duration_in_secs: input.duration() as f64 / AV_TIME_BASE as f64,

apps/web/app/(org)/dashboard/spaces/[spaceId]/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ export default async function SharedCapsPage({
326326
videos.createdAt,
327327
videos.metadata,
328328
users.name,
329+
videos.duration,
329330
)
330331
.orderBy(
331332
desc(

apps/web/app/api/upload/[...route]/multipart.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,9 @@ app.post(
287287
height: updateIfDefined(body.height, videos.height),
288288
fps: updateIfDefined(body.fps, videos.fps),
289289
})
290-
.where(eq(videos.id, videoIdToUse));
290+
.where(
291+
and(eq(videos.id, videoIdToUse), eq(videos.ownerId, user.id)),
292+
);
291293

292294
if (videoIdFromFileKey) {
293295
try {

apps/web/app/api/upload/[...route]/signed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { s3Buckets, videos } from "@cap/database/schema";
77
import type { VideoMetadata } from "@cap/database/types";
88
import { serverEnv } from "@cap/env";
99
import { zValidator } from "@hono/zod-validator";
10-
import { eq, sql } from "drizzle-orm";
10+
import { and, eq, sql } from "drizzle-orm";
1111
import { Hono } from "hono";
1212
import { z } from "zod";
1313
import { createBucketProvider } from "@/utils/s3";
@@ -154,7 +154,7 @@ app.post(
154154
height: updateIfDefined(height, videos.height),
155155
fps: updateIfDefined(fps, videos.fps),
156156
})
157-
.where(eq(videos.id, videoIdToUse));
157+
.where(and(eq(videos.id, videoIdToUse), eq(videos.ownerId, user.id)));
158158

159159
if (videoIdFromKey) {
160160
try {

packages/database/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ export const db = () => {
3636

3737
// Use the incoming value if one exists, else fallback to the DBs existing value.
3838
export const updateIfDefined = <T>(v: T | undefined, col: AnyMySqlColumn) =>
39-
sql`COALESCE(${v ?? sql`NULL`}, ${col})`;
39+
sql`COALESCE(${v === undefined ? sql`NULL` : v}, ${col})`;

0 commit comments

Comments
 (0)