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.

fixed a bug

Steven Teyc9306166a129
diff --git a/pages/api/edge/links/index.ts b/pages/api/edge/links/index.ts
index 70a7330faf..8a4300be0a 100644
--- a/pages/api/edge/links/index.ts
+++ b/pages/api/edge/links/index.ts
@@ -1,6 +1,6 @@
import type { NextRequest } from "next/server";
import { setRandomKey } from "@/lib/upstash";
-import { SECOND_LEVEL_DOMAINS } from "@/lib/constants";
+import { BLACKLIST } from "@/lib/constants";
import { getDomainWithoutWWW } from "@/lib/utils";
export const config = {
@@ -13,7 +13,7 @@ export default async function handler(req: NextRequest) {
if (!url) {
return new Response(`Missing url`, { status: 400 });
}
- if (SECOND_LEVEL_DOMAINS.has(getDomainWithoutWWW(url))) {
+ if (BLACKLIST.has(getDomainWithoutWWW(url))) {
return new Response(`Invalid url`, { status: 400 });
}
const { response, key } = await setRandomKey(url);
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index ca738e6691..2b4340f4b4 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -1,7 +1,7 @@
import { NextApiRequest, NextApiResponse } from "next";
import { addLink, getLinksForProject } from "@/lib/api/links";
import { Session, withUserAuth } from "@/lib/auth";
-import { SECOND_LEVEL_DOMAINS } from "@/lib/constants";
+import { BLACKLIST } from "@/lib/constants";
import { getDomainWithoutWWW } from "@/lib/utils";
// This is a special route for retrieving and creating custom dub.sh links.
@@ -28,7 +28,7 @@ export default withUserAuth(
if (!key || !url) {
return res.status(400).json({ error: "Missing key or url" });
}
- if (SECOND_LEVEL_DOMAINS.has(getDomainWithoutWWW(url))) {
+ if (BLACKLIST.has(getDomainWithoutWWW(url))) {
return res.status(400).json({ error: "Invalid url" });
}
const response = await addLink({