Skip to content

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

fix: moving folders to subfolders didn't update the path properly

Marc Seitza3de03b159cd
diff --git a/pages/api/teams/[teamId]/datarooms/[id]/folders/move.ts b/pages/api/teams/[teamId]/datarooms/[id]/folders/move.ts
index 21b4ce40..ea4a7ab4 100644
--- a/pages/api/teams/[teamId]/datarooms/[id]/folders/move.ts
+++ b/pages/api/teams/[teamId]/datarooms/[id]/folders/move.ts
@@ -81,12 +81,12 @@ export default async function handle(
});
}
}
- // Fetch all nested subfolders of the selected folders
+ // Fetch all nested subfolders of the selected folders (excluding the folders themselves)
const allSubfolders = await prisma.dataroomFolder.findMany({
where: {
dataroomId: dataroomId,
OR: foldersToMove.map((folder) => ({
- path: { startsWith: folder.path },
+ path: { startsWith: `${folder.path}/` },
})),
},
});
diff --git a/pages/api/teams/[teamId]/folders/move.ts b/pages/api/teams/[teamId]/folders/move.ts
index b4e25a78..a5f31278 100644
--- a/pages/api/teams/[teamId]/folders/move.ts
+++ b/pages/api/teams/[teamId]/folders/move.ts
@@ -71,12 +71,12 @@ export default async function handle(
});
}
}
- // Fetch all nested subfolders of the selected folders
+ // Fetch all nested subfolders of the selected folders (excluding the folders themselves)
const allSubfolders = await prisma.folder.findMany({
where: {
teamId,
OR: foldersToMove.map((folder) => ({
- path: { startsWith: folder.path },
+ path: { startsWith: `${folder.path}/` },
})),
},
});