The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
sanitize NOT IN
Steven Teyac280d2eecf1
diff --git a/apps/web/app/(ee)/api/cron/export/events/partner/route.ts b/apps/web/app/(ee)/api/cron/export/events/partner/route.tsindex c59cfd9372..c506ab1e08 100644--- a/apps/web/app/(ee)/api/cron/export/events/partner/route.ts+++ b/apps/web/app/(ee)/api/cron/export/events/partner/route.ts@@ -91,6 +91,23 @@ export async function POST(req: Request) {"One or more links are not found. Skipping the export.",);}+ if (linkId.sqlOperator === "NOT IN") {+ // if using NOT IN operator, we need to include all links except the ones in the linkId.values+ const finalIncludedLinkIds = links+ .filter((link) => !linkId.values.includes(link.id))+ .map((link) => link.id);++ // early return if no links are left+ if (finalIncludedLinkIds.length === 0) {+ return logAndRespond("No links found. Skipping the export.");+ }++ parsedParams.linkId = {+ operator: "IS",+ sqlOperator: "IN",+ values: finalIncludedLinkIds,+ };+ }} else if (domain && key) {const link = links.find((link) =>diff --git a/apps/web/app/(ee)/api/groups/[groupIdOrSlug]/route.ts b/apps/web/app/(ee)/api/groups/[groupIdOrSlug]/route.tsindex 42cd05ada8..8763d8f55f 100644--- a/apps/web/app/(ee)/api/groups/[groupIdOrSlug]/route.ts+++ b/apps/web/app/(ee)/api/groups/[groupIdOrSlug]/route.ts@@ -300,6 +300,13 @@ export const DELETE = withWorkspace(}),]);+ if (group.programId !== programId) {+ throw new DubApiError({+ code: "forbidden",+ message: `Group "${groupIdOrSlug}" not found in your program.`,+ });+ }+if (group.slug === DEFAULT_PARTNER_GROUP.slug) {throw new DubApiError({code: "forbidden",diff --git a/apps/web/lib/api/groups/get-group-or-throw.ts b/apps/web/lib/api/groups/get-group-or-throw.tsindex a0e27105bd..34027f060e 100644--- a/apps/web/lib/api/groups/get-group-or-throw.ts+++ b/apps/web/lib/api/groups/get-group-or-throw.ts@@ -41,14 +41,14 @@ export const getGroupOrThrow = async ({if (!group) {throw new DubApiError({code: "not_found",- message: `Group with ID ${groupId} not found.`,+ message: `Group "${groupId}" not found.`,});}if (group.programId !== programId) {throw new DubApiError({code: "forbidden",- message: `Group with ID ${groupId} not found in your program.`,+ message: `Group "${groupId}" not found in your program.`,});}