The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improve error message
Steven Tey238420a940e6
diff --git a/lib/auth.ts b/lib/auth.tsindex 404af606ce..b6adb7d0f2 100644--- a/lib/auth.ts+++ b/lib/auth.ts@@ -253,8 +253,16 @@ const withLinksAuth =let session: Session | undefined;- const apiKey = req.headers.authorization?.split("Bearer ")[1];- if (apiKey) {+ const authorizationHeader = req.headers.authorization;+ if (authorizationHeader) {+ if (!authorizationHeader.includes("Bearer ")) {+ return res+ .status(400)+ .end(+ "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://dub.sh/auth ",+ );+ }+ const apiKey = authorizationHeader.replace("Bearer ", "");// if there is no slug, it's the default dub.sh linkif (!slug) {return res