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.

only check allowedHostnames for not root keys

Steven Tey28955151be3a
diff --git a/apps/web/lib/api/links/process-link.ts b/apps/web/lib/api/links/process-link.ts
index 46c8e4327c..0cd0700774 100644
--- a/apps/web/lib/api/links/process-link.ts
+++ b/apps/web/lib/api/links/process-link.ts
@@ -193,7 +193,11 @@ export async function processLink<T extends Record<string, any>>({
// coerce type with ! cause we already checked if it exists
const { allowedHostnames } = DUB_DOMAINS.find((d) => d.slug === domain)!;
const urlDomain = getApexDomain(url) || "";
- if (allowedHostnames && !allowedHostnames.includes(urlDomain)) {
+ if (
+ key !== "_root" &&
+ allowedHostnames &&
+ !allowedHostnames.includes(urlDomain)
+ ) {
return {
link: payload,
error: `Invalid destination URL. You can only create ${domain} short links for URLs with the domain${allowedHostnames.length > 1 ? "s" : ""} ${allowedHostnames