Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
show error if domain link and plan is free
Marc Seitz94782bd818d3
diff --git a/pages/api/links/domains/[domain]/[slug]/index.ts b/pages/api/links/domains/[domain]/[slug]/index.tsindex cb29aa89..ac26ee5e 100644--- a/pages/api/links/domains/[domain]/[slug]/index.ts+++ b/pages/api/links/domains/[domain]/[slug]/index.ts@@ -23,14 +23,24 @@ export default async function handle(emailProtected: true,allowDownload: true,password: true,- document: { select: { id: true } },+ document: { select: { id: true, owner: {select: { plan: true } } } },},});+ console.log("plan", link);+if (!link) {return res.status(404).json({ error: "Link not found" });}++ console.log("plan", link.document.owner.plan)++ // if owner of document is on free plan, return 404+ if (link.document.owner.plan === "free") {+ return res.status(404).json({ error: "Link not found" });+ }+res.status(200).json(link);} catch (error) {return res.status(500).json({