Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(api): sanitize limit and offset query params in videos endpoint

Richie McIlroy9ce6eecf6658
diff --git a/apps/web/app/api/developer/v1/[...route]/videos.ts b/apps/web/app/api/developer/v1/[...route]/videos.ts
index bf0a1f08a..e8cbecdb1 100644
--- a/apps/web/app/api/developer/v1/[...route]/videos.ts
+++ b/apps/web/app/api/developer/v1/[...route]/videos.ts
@@ -14,8 +14,8 @@ export const app = new Hono<{
app.get("/", async (c) => {
const appId = c.get("developerAppId");
const userId = c.req.query("userId");
- const limit = Math.min(Number(c.req.query("limit") ?? 50), 100);
- const offset = Number(c.req.query("offset") ?? 0);
+ const limit = Math.min(Number(c.req.query("limit") ?? 50) || 50, 100);
+ const offset = Math.max(0, Number(c.req.query("offset") ?? 0) || 0);
const conditions = [
eq(developerVideos.appId, appId),