Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: preserve mobile download 404s

Richie McIlroya22ae44eb705
diff --git a/apps/web/app/api/mobile/[...route]/route.ts b/apps/web/app/api/mobile/[...route]/route.ts
index 4e07ea46e..5eaf7d645 100644
--- a/apps/web/app/api/mobile/[...route]/route.ts
+++ b/apps/web/app/api/mobile/[...route]/route.ts
@@ -1303,13 +1303,12 @@ const ApiLive = HttpApiBuilder.api(Mobile.MobileApiContract).pipe(
withMappedErrors(
Effect.gen(function* () {
const user = yield* CurrentUser;
- const [video] = yield* videos.getByIdForViewing(path.id).pipe(
- Effect.flatten,
- Effect.catchTag(
- "NoSuchElementException",
- () => new Video.NotFoundError(),
- ),
- );
+ const repo = yield* VideosRepo;
+ const maybeVideo = yield* repo.getById(path.id);
+ if (Option.isNone(maybeVideo)) {
+ return yield* Effect.fail(new HttpApiError.NotFound());
+ }
+ const [video] = maybeVideo.value;
if (video.ownerId !== user.id) {
return yield* Effect.fail(new HttpApiError.NotFound());
}