The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix subdirectory check
Steven Tey450749a29ca2
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.tsindex aad61d8dc0..bebfcd4d0d 100644--- a/apps/web/lib/api/links/process-link.ts+++ b/apps/web/lib/api/links/process-link.ts@@ -225,13 +225,13 @@ export async function processLink<T extends Record<string, any>>({}}- if (key?.includes("/")) {- // check if the user has access to the parent link+ if (!skipKeyChecks && key?.includes("/")) {+ // check if the workspace has access to the parent linkconst parentKey = key.split("/")[0];const parentLink = await prisma.link.findUnique({where: { domain_key: { domain, key: parentKey } },});- if (parentLink?.userId !== userId) {+ if (parentLink?.projectId !== workspace?.id) {return {link: payload,error: `You do not have access to create links in the ${domain}/${parentKey}/ subdirectory.`,