The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
maliciousLinkCheck for `dub.link` as well
Steven Tey8d0ffb46d81c
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.tsindex 1ed6819841..a3d240b01f 100644--- a/apps/web/lib/api/links/process-link.ts+++ b/apps/web/lib/api/links/process-link.ts@@ -146,10 +146,20 @@ export async function processLink<T extends Record<string, any>>({domain = domains?.find((d) => d.primary)?.slug || "dub.sh";}- // checks for dub.sh links- if (domain === "dub.sh") {- // check if user exists (if userId is passed)- if (userId) {+ // checks for dub.sh and dub.link links+ if (domain === "dub.sh" || domain === "dub.link") {+ // for dub.link: check if workspace plan is pro++ if (domain === "dub.link" && (!workspace || workspace.plan === "free")) {+ return {+ link: payload,+ error:+ "You can only use dub.link on a Pro plan and above. Upgrade to Pro to use this domain.",+ code: "forbidden",+ };+ }++ // for dub.sh: check if user exists (if userId is passed)+ if (domain === "dub.sh" && userId) {const userExists = await checkIfUserExists(userId);if (!userExists) {return {@@ -168,15 +178,6 @@ export async function processLink<T extends Record<string, any>>({code: "unprocessable_entity",};}- } else if (domain === "dub.link") {- if (!workspace || workspace.plan === "free") {- return {- link: payload,- error:- "You can only use dub.link on a Pro plan and above. Upgrade to Pro to use this domain.",- code: "forbidden",- };- }// checks for other Dub-owned domains (chatg.pt, spti.fi, etc.)} else if (isDubDomain(domain)) {// coerce type with ! cause we already checked if it exists