The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
bug fixes
Steven Tey20f83f01a818
diff --git a/apps/web/app/api/links/verify/route.ts b/apps/web/app/api/links/verify/route.tsindex a4496e25c9..f6ffb17817 100644--- a/apps/web/app/api/links/verify/route.ts+++ b/apps/web/app/api/links/verify/route.ts@@ -1,6 +1,5 @@import { DubApiError, handleAndReturnErrorResponse } from "@/lib/api/errors";import { keyChecks, processKey } from "@/lib/api/links";-import { withAuth } from "@/lib/auth";import { getWorkspaceViaEdge } from "@/lib/planetscale";import { workspaceIdSchema } from "@/lib/zod";import { domainKeySchema } from "@/lib/zod/schemas";diff --git a/apps/web/lib/middleware/utils/get-final-url.ts b/apps/web/lib/middleware/utils/get-final-url.tsindex c3fcf92177..5573f811e1 100644--- a/apps/web/lib/middleware/utils/get-final-url.ts+++ b/apps/web/lib/middleware/utils/get-final-url.ts@@ -17,7 +17,7 @@ export const getFinalUrl = (url: string, { req }: { req: NextRequest }) => {}if (urlObj.searchParams.get("qr") === "1") {- // remove qr param from the final url (only used for detectQr function)+ // remove qr param from the final url if the value is "1" (only used for detectQr function)urlObj.searchParams.delete("qr");}diff --git a/apps/web/lib/planetscale.ts b/apps/web/lib/planetscale.tsindex 9ca809a5ac..3602b86e45 100644--- a/apps/web/lib/planetscale.ts+++ b/apps/web/lib/planetscale.ts@@ -41,7 +41,7 @@ export const checkIfKeyExists = async (domain: string, key: string) => {const { rows } =(await conn.execute("SELECT 1 FROM Link WHERE domain = ? AND `key` = ? LIMIT 1",- [domain, decodeURIComponent(key)], // we need to make sure that the key is always decoded (cause that's how we store it in MySQL)+ [domain, punyEncode(decodeURIComponent(key))], // we need to make sure that the key is always URI-decoded + punycode-encoded (cause that's how we store it in MySQL))) || {};return rows && Array.isArray(rows) && rows.length > 0;diff --git a/apps/web/lib/swr/use-domains.ts b/apps/web/lib/swr/use-domains.tsindex 17a51a54c6..596bd652c1 100644--- a/apps/web/lib/swr/use-domains.ts+++ b/apps/web/lib/swr/use-domains.ts@@ -49,8 +49,10 @@ export default function useDomains({];const primaryDomain =- activeWorkspaceDomains?.find((domain) => domain.primary)?.slug ||- SHORT_DOMAIN;+ activeWorkspaceDomains && activeWorkspaceDomains.length > 0+ ? activeWorkspaceDomains.find((domain) => domain.primary)?.slug ||+ activeWorkspaceDomains[0].slug+ : SHORT_DOMAIN;const verified = domain? // If a domain is passed, check if it's verified