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.

Fix #223 (don't allow "/" short links)

Steven Tey2126342fdcef
diff --git a/pages/api/links/[key]/index.ts b/pages/api/links/[key]/index.ts
index 185462948b..ee5f972960 100644
--- a/pages/api/links/[key]/index.ts
+++ b/pages/api/links/[key]/index.ts
@@ -41,6 +41,8 @@ export default withLinksAuth(
if (domainBlacklisted) {
return res.status(422).end("Invalid url.");
}
+ } else if (key === "/") {
+ return res.status(422).end("Key cannot be '/'.");
}
const [response, invalidFavicon] = await Promise.allSettled([
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index 1d886a689a..7543be5b1a 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -57,6 +57,8 @@ export default withLinksAuth(
if (domainBlacklisted) {
return res.status(422).end("Invalid url.");
}
+ } else if (key === "/") {
+ return res.status(422).end("Key cannot be '/'.");
}
const [response, invalidFavicon] = await Promise.allSettled([