The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fixed links stats page 404 bug
Steven Tey565b039fd9c3
diff --git a/components/app/modals/delete-project-modal.tsx b/components/app/modals/delete-project-modal.tsxindex f3fdc48538..8d8f0c49dc 100644--- a/components/app/modals/delete-project-modal.tsx+++ b/components/app/modals/delete-project-modal.tsx@@ -9,7 +9,6 @@ import {import { toast } from "sonner";import { mutate } from "swr";import BlurImage from "#/ui/blur-image";-import { LoadingDots } from "#/ui/icons";import Modal from "@/components/shared/modal";import useProject from "@/lib/swr/use-project";import Button from "#/ui/button";@@ -94,6 +93,7 @@ function DeleteProjectModal({name="project-slug"id="project-slug"autoFocus={false}+ autoComplete="off"pattern={slug}className="block w-full rounded-md border-gray-300 pr-10 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"/>@@ -119,6 +119,7 @@ function DeleteProjectModal({pattern="confirm delete project"requiredautoFocus={false}+ autoComplete="off"className="block w-full rounded-md border-gray-300 pr-10 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:outline-none focus:ring-gray-500 sm:text-sm"/></div>diff --git a/lib/auth.ts b/lib/auth.tsindex 56578a3772..b2f962ac66 100644--- a/lib/auth.ts+++ b/lib/auth.ts@@ -303,7 +303,7 @@ const withLinksAuth =// if key is defined, check if the current user is the owner of the link (only for dub.sh links)const { key } = req.query;- if (key && domain === "dub.sh" && !skipKeyCheck) {+ if (key && !domain && !skipKeyCheck) {if (typeof key !== "string") {return res.status(400).end("Missing or misconfigured link key.");}@@ -321,7 +321,7 @@ const withLinksAuth =// for dub.sh links, check if the user is the owner of the link} else if (!slug && link.userId !== session.user.id) {- return res.status(403).end("Unauthorized: Not link owner.");+ return res.status(404).end("Link not found.");}}diff --git a/pages/app/links/[key].tsx b/pages/app/links/[key].tsxindex 46c834f005..d5881036cb 100644--- a/pages/app/links/[key].tsx+++ b/pages/app/links/[key].tsx@@ -7,7 +7,7 @@ export default function StatsPage() {const { loading, error } = useLink();// if not owner, show 404 page- if (error) {+ if (error && error.status === 404) {return <ErrorPage statusCode={404} />;}