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.

account for _root in linkConstructor

Steven Teye3b58c179e27
diff --git a/lib/utils.ts b/lib/utils.ts
index 1189a2dbb5..765887f3d7 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -78,9 +78,9 @@ export function linkConstructor({
pretty?: boolean;
noDomain?: boolean;
}) {
- const link = `${
- localhost ? "http://localhost:3000" : `https://${domain}`
- }/${key}`;
+ const link = `${localhost ? "http://localhost:3000" : `https://${domain}`}${
+ key !== "_root" ? `/${key}` : ""
+ }`;
if (noDomain) return `/${key}`;
return pretty ? link.replace(/^https?:\/\//, "") : link;