The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update utils.ts
Steven Tey149ff0eb0f5f
diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.tsindex 2f25f61c5b..f75a21052d 100644--- a/lib/middleware/utils.ts+++ b/lib/middleware/utils.ts@@ -32,6 +32,7 @@ export const getFinalUrl = (target: string, { req }: { req: NextRequest }) => {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 url+ // @ts-ignore – until https://github.com/microsoft/TypeScript/issues/54466 is fixedconst targetUrl = new URL(decodeURIComponent(target));// if searchParams (type: `URLSearchParams`) has the same key as target url, then overwrite it