Skip to content

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

fix: get versionNumber in link and return notfound

Marc Seitz32c2417a6f7a
diff --git a/pages/api/links/[id]/index.ts b/pages/api/links/[id]/index.ts
index 794d157a..b9594293 100644
--- a/pages/api/links/[id]/index.ts
+++ b/pages/api/links/[id]/index.ts
@@ -25,7 +25,16 @@ export default async function handle(
allowDownload: true,
password: true,
isArchived: true,
- document: { select: { id: true, name: true } },
+ document: {
+ select: {
+ id: true,
+ versions: {
+ where: { isPrimary: true },
+ select: { versionNumber: true },
+ take: 1,
+ },
+ },
+ },
},
});
diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsx
index a53a7f0c..23d7d4a5 100644
--- a/pages/view/domains/[domain]/[slug]/index.tsx
+++ b/pages/view/domains/[domain]/[slug]/index.tsx
@@ -9,7 +9,7 @@ export default function ViewPage() {
const { data: session, status } = useSession();
if (error && error.status === 404) {
- <NotFound />;
+ return <NotFound />;
}
if (!link || status === "loading") {