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.

use fullKey instead

Steven Teycaca90954336
diff --git a/apps/web/lib/middleware/utils/crawl-bitly.ts b/apps/web/lib/middleware/utils/crawl-bitly.ts
index 3d4f196c49..f5e13d206d 100644
--- a/apps/web/lib/middleware/utils/crawl-bitly.ts
+++ b/apps/web/lib/middleware/utils/crawl-bitly.ts
@@ -4,14 +4,14 @@ import { NextRequest, NextResponse } from "next/server";
import { parse } from "./parse";
export const crawlBitly = async (req: NextRequest) => {
- const { domain, key } = parse(req);
+ const { domain, fullKey } = parse(req);
// bitly doesn't support the following characters: ` ~ , . < > ; ‘ : “ / \ [ ] ^ { } ( ) = + ! * @ & $ £ ? % # |
// @see: https://support.bitly.com/hc/en-us/articles/360030780892-What-characters-are-supported-when-customizing-links
const invalidBitlyKeyRegex = /[`~,.<>;':"/\\[\]^{}()=+!*@&$£?%#|]/;
- if (key && !invalidBitlyKeyRegex.test(key)) {
- const link = await fetchBitlyLink({ domain, key });
+ if (fullKey && !invalidBitlyKeyRegex.test(fullKey)) {
+ const link = await fetchBitlyLink({ domain, key: fullKey });
if (link) {
return NextResponse.redirect(link.long_url, {
headers: DUB_HEADERS,
diff --git a/apps/web/lib/middleware/utils/parse.ts b/apps/web/lib/middleware/utils/parse.ts
index 2cafc5b744..3f84cb673a 100644
--- a/apps/web/lib/middleware/utils/parse.ts
+++ b/apps/web/lib/middleware/utils/parse.ts
@@ -1,4 +1,3 @@
-import { SHORT_DOMAIN } from "@dub/utils";
import { NextRequest } from "next/server";
export const parse = (req: NextRequest) => {
@@ -14,7 +13,7 @@ export const parse = (req: NextRequest) => {
domain = "dub-internal-test.com";
} else {
// for local development and preview URLs
- domain = SHORT_DOMAIN;
+ domain = "buff.ly";
}
}