Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: if folderId is null, then no newPath
Marc Seitz643a2993eda6
diff --git a/pages/api/teams/[teamId]/datarooms/[id]/documents/move.ts b/pages/api/teams/[teamId]/datarooms/[id]/documents/move.tsindex a66294e2..e1e5bbc3 100644--- a/pages/api/teams/[teamId]/datarooms/[id]/documents/move.ts+++ b/pages/api/teams/[teamId]/datarooms/[id]/documents/move.ts@@ -24,7 +24,7 @@ export default async function handle(};const { documentIds, folderId } = req.body as {documentIds: string[];- folderId: string;+ folderId: string | null;};// Ensure the user is an admin of the team@@ -58,11 +58,14 @@ export default async function handle(},});- // Get new path for folder- const folder = await prisma.dataroomFolder.findUnique({- where: { id: folderId },- select: { path: true },- });+ // Get new path for folder unless folderId is null+ let folder: { path: string } | null = null;+ if (folderId) {+ folder = await prisma.dataroomFolder.findUnique({+ where: { id: folderId },+ select: { path: true },+ });+ }if (updatedDocuments.count === 0) {return res.status(404).end("No documents were updated");