Skip to content

Commit bfd47a7

Browse files
committed
read videoId properly
1 parent d061707 commit bfd47a7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ app.post(
4646
subpath: "result.mp4",
4747
});
4848

49+
const videoIdFromFileKey = fileKey.split("/")[1];
50+
const videoId = "videoId" in body ? body.videoId : videoIdFromFileKey;
51+
if (!videoId) throw new Error("Video ID is required");
52+
4953
const resp = await Effect.gen(function* () {
5054
const videos = yield* Videos;
5155
const db = yield* Database;
5256

53-
const video = yield* videos.getById(Video.VideoId.make(user.id));
57+
const video = yield* videos.getById(Video.VideoId.make(videoId));
5458
if (Option.isNone(video)) return yield* new Video.NotFoundError();
5559

5660
yield* db.use((db) =>

0 commit comments

Comments
 (0)