Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(web): return 404 for segment playlist with no video segments

Richie McIlroy4ba0c2b584fe
diff --git a/apps/web/app/api/playlist/route.ts b/apps/web/app/api/playlist/route.ts
index 02611adaa..19cd1161f 100644
--- a/apps/web/app/api/playlist/route.ts
+++ b/apps/web/app/api/playlist/route.ts
@@ -179,8 +179,14 @@ const getPlaylistResponse = (
const manifest = yield* Schema.decodeUnknown(Video.SegmentManifest)(
parsed,
).pipe(Effect.mapError(() => new HttpApiError.InternalServerError()));
+ const hasVideoSegments =
+ manifest.video_init_uploaded && manifest.video_segments.length > 0;
if (urlParams.videoType === "segments-master") {
+ if (!hasVideoSegments) {
+ return yield* Effect.fail(new HttpApiError.NotFound());
+ }
+
const videoPlaylistUrl = `${serverEnv().WEB_URL}/api/playlist?videoId=${video.id}&videoType=segments-video`;
const audioPlaylistUrl = manifest.audio_init_uploaded
? `${serverEnv().WEB_URL}/api/playlist?videoId=${video.id}&videoType=segments-audio`