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 detect-bot.ts

Steven Tey738083b35fb2
diff --git a/apps/web/lib/middleware/utils/detect-bot.ts b/apps/web/lib/middleware/utils/detect-bot.ts
index bc096fb224..972fce5f2b 100644
--- a/apps/web/lib/middleware/utils/detect-bot.ts
+++ b/apps/web/lib/middleware/utils/detect-bot.ts
@@ -12,12 +12,8 @@ export const detectBot = (req: Request) => {
// Check ua
const ua = userAgent(req);
- if (!ua) {
- return false;
- }
-
- if (ua.isBot || UA_BOTS.some((bot) => new RegExp(bot, "i").test(ua.ua))) {
- return true;
+ if (ua) {
+ return ua.isBot || UA_BOTS.some((bot) => new RegExp(bot, "i").test(ua.ua));
}
// Check ip