Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update utils.ts

Steven Teyd2e55aa67ca6
diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.ts
index f75a21052d..f785cd7c67 100644
--- a/lib/middleware/utils.ts
+++ b/lib/middleware/utils.ts
@@ -29,10 +29,10 @@ export const getFinalUrl = (target: string, { req }: { req: NextRequest }) => {
// query is the query string (e.g. dub.sh/github?utm_source=twitter -> ?utm_source=twitter)
const searchParams = req.nextUrl.searchParams;
+ // @ts-ignore – until https://github.com/microsoft/TypeScript/issues/54466 is fixed
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 fixed
const targetUrl = new URL(decodeURIComponent(target));
// if searchParams (type: `URLSearchParams`) has the same key as target url, then overwrite it