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 Tey67a6ae550e37
diff --git a/lib/utils.ts b/lib/utils.ts
index 96c79f4d9b..aca065306a 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -12,6 +12,7 @@ import {
HOME_HOSTNAMES,
HOME_DOMAIN,
} from "./constants";
+import punycode from "punycode/";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
@@ -133,9 +134,11 @@ export function linkConstructor({
pretty?: boolean;
noDomain?: boolean;
}) {
- const link = `${localhost ? "http://localhost:3000" : `https://${domain}`}${
- key !== "_root" ? `/${key}` : ""
- }`;
+ const link = `${
+ localhost
+ ? "http://localhost:3000"
+ : `https://${punycode.toUnicode(domain)}`
+ }${key !== "_root" ? `/${key}` : ""}`;
if (noDomain) return `/${key}`;
return pretty ? link.replace(/^https?:\/\//, "") : link;