The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix issue with query params
Steven Teya6de6f8046b0
diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.tsindex 08a433ca14..2f25f61c5b 100644--- a/lib/middleware/utils.ts+++ b/lib/middleware/utils.ts@@ -26,9 +26,11 @@ export const parse = (req: NextRequest) => {};export const getFinalUrl = (target: string, { req }: { req: NextRequest }) => {- // query is the query string (e.g. dub.sh/github/repo?utm_source=twitter -> ?utm_source=twitter)+ // query is the query string (e.g. dub.sh/github?utm_source=twitter -> ?utm_source=twitter)const searchParams = req.nextUrl.searchParams;+ if (searchParams.size === 0) return target; // if there are no query params, then return the target url as is (no need to parse it+// get the query params of the target urlconst targetUrl = new URL(decodeURIComponent(target));