Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: check team plan on custom domain link

Marc Seitz6f1ec37de014
diff --git a/pages/api/links/domains/[domain]/[slug]/index.ts b/pages/api/links/domains/[domain]/[slug]/index.ts
index ac26ee5e..2413b3b9 100644
--- a/pages/api/links/domains/[domain]/[slug]/index.ts
+++ b/pages/api/links/domains/[domain]/[slug]/index.ts
@@ -23,21 +23,21 @@ export default async function handle(
emailProtected: true,
allowDownload: true,
password: true,
- document: { select: { id: true, owner: {select: { plan: true } } } },
+ document: { select: { id: true, team: {select: { plan: true } } } },
},
});
console.log("plan", link);
- if (!link) {
+ if (!link || link.document.team == null) {
return res.status(404).json({ error: "Link not found" });
}
- console.log("plan", link.document.owner.plan)
+ console.log("plan", link.document.team.plan)
// if owner of document is on free plan, return 404
- if (link.document.owner.plan === "free") {
+ if (link.document.team.plan === "free") {
return res.status(404).json({ error: "Link not found" });
}