Skip to content

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

fix: add revalidation on link creation

Marc Seitz36862a511903
diff --git a/pages/api/links/index.ts b/pages/api/links/index.ts
index 20c3310e..73e751ee 100644
--- a/pages/api/links/index.ts
+++ b/pages/api/links/index.ts
@@ -287,6 +287,11 @@ export default async function handler(
}),
);
+ // Revalidate the view page to pre-generate it
+ await fetch(
+ `${process.env.NEXTAUTH_URL}/api/revalidate?secret=${process.env.REVALIDATE_TOKEN}&linkId=${linkWithView.id}&hasDomain=${linkWithView.domainId ? "true" : "false"}`,
+ );
+
// Decrypt the password for the new link
if (linkWithView.password !== null) {
linkWithView.password = decryptEncrpytedPassword(linkWithView.password);