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 Tey4030d1c4510e
diff --git a/apps/web/lib/middleware/utils.ts b/apps/web/lib/middleware/utils.ts
index ce9c610164..37ab513a1f 100644
--- a/apps/web/lib/middleware/utils.ts
+++ b/apps/web/lib/middleware/utils.ts
@@ -32,9 +32,8 @@ export const getFinalUrl = (url: string, { req }: { req: NextRequest }) => {
// get the query params of the target url
const urlObj = new URL(url);
- // @ts-ignore – until https://github.com/microsoft/TypeScript/issues/54466 is fixed
- if (searchParams.size === 0) return urlObj.toString(); // if there are no query params, then return the target url as is (no need to parse it)
-
+ // if there are no query params, then return the target url as is (no need to parse it)
+ if (searchParams.size === 0) return url;
// if searchParams (type: `URLSearchParams`) has the same key as target url, then overwrite it
for (const [key, value] of searchParams) {
urlObj.searchParams.set(key, value);