The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix for edge too
Steven Tey6fae23e8e699
diff --git a/apps/web/lib/auth/workspace-edge.ts b/apps/web/lib/auth/workspace-edge.tsindex 49bef17ed7..f1c6c85d00 100644--- a/apps/web/lib/auth/workspace-edge.ts+++ b/apps/web/lib/auth/workspace-edge.ts@@ -102,14 +102,29 @@ export const withWorkspaceEdge = (params?.slug ||searchParams.projectSlug;- // if there's no workspace ID or slug and it's not a restricted token- // For restricted tokens, we find the workspaceId from the token+ /*+ if there's no workspace ID or slug and it's not a restricted token:+ - special case for anonymous link creation+ - missing authorization header+ - user is still using personal API keys+ */if (!idOrSlug && !isRestrictedToken) {- if (!authorizationHeader) {+ // special case for anonymous link creation+ if (req.headers.has("dub-anonymous-link-creation")) {+ // @ts-expect-error+ return await handler({+ req,+ params,+ searchParams,+ headers,+ });+ // missing authorization header+ } else if (!authorizationHeader) {throw new DubApiError({code: "unauthorized",message: "Missing Authorization header.",});+ // in case user is still using personal API keys} else {throw new DubApiError({code: "not_found",diff --git a/apps/web/lib/auth/workspace.ts b/apps/web/lib/auth/workspace.tsindex a91fb42a92..22068d6022 100644--- a/apps/web/lib/auth/workspace.ts+++ b/apps/web/lib/auth/workspace.ts@@ -100,8 +100,12 @@ export const withWorkspace = (params?.slug ||searchParams.projectSlug;- // if there's no workspace ID or slug and it's not a restricted token- // For restricted tokens, we find the workspaceId from the token+ /*+ if there's no workspace ID or slug and it's not a restricted token:+ - special case for anonymous link creation+ - missing authorization header+ - user is still using personal API keys+ */if (!idOrSlug && !isRestrictedToken) {// special case for anonymous link creationif (req.headers.has("dub-anonymous-link-creation")) {