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 auth-app.ts

Steven Tey51d42c1d3d28
diff --git a/apps/web/lib/auth-app.ts b/apps/web/lib/auth-app.ts
index 7531f26b00..6ca66e97b9 100644
--- a/apps/web/lib/auth-app.ts
+++ b/apps/web/lib/auth-app.ts
@@ -182,13 +182,14 @@ const withAuth =
status: 403,
});
}
- }
-
- // check for Dub.sh links
- if (domain === "dub.sh" && link && link.userId !== session.user.id) {
- return new Response("Unauthorized: Invalid link.", {
- status: 401,
- });
+ } else {
+ // no slug means it's a generic Dub.sh link
+ // thus, we need to make sure the user is the owner of the link
+ if (link && link.userId !== session.user.id) {
+ return new Response("Unauthorized: Invalid link.", {
+ status: 401,
+ });
+ }
}
return handler({ req, params, searchParams, session, project, link });