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 links.ts

Steven Tey899f902cb00d
diff --git a/apps/web/lib/api/links.ts b/apps/web/lib/api/links.ts
index 04b1836e4a..bf5f167159 100644
--- a/apps/web/lib/api/links.ts
+++ b/apps/web/lib/api/links.ts
@@ -175,11 +175,14 @@ export async function getRandomKey(domain: string): Promise<string> {
export async function checkIfKeyExists(domain: string, key: string) {
// reserved keys for dub.sh
if (domain === "dub.sh") {
- return (await isReservedKey(key)) || DEFAULT_REDIRECTS[key];
-
+ if ((await isReservedKey(key)) || DEFAULT_REDIRECTS[key]) {
+ return true;
+ }
// if it's a default Dub domain, check if the key is a reserved key
} else if (isDubDomain(domain)) {
- return await isReservedUsername(key);
+ if (await isReservedUsername(key)) {
+ return true;
+ }
}
const link = await prisma.link.findUnique({
where: {