Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion projects/app/src/pages/api/admin/initv4141.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ async function appSplitMigration(teamId: string) {

for (const folder of allFolders) {
const obj = appMap.get(folder._id)!;
const newParentId = obj?.parentId ? appMap.get(obj!.parentId)?.newId : null;
if (!newParentId) {
continue;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Top-Level Folder Permissions Migration Failure

The early continue at line 97 skips resource permission migration for top-level folders (folders without a parent). When obj.parentId is null/undefined, newParentId becomes null, causing the loop to skip before the rpOps.push at line 101, preventing these folders from having their permissions properly migrated to the new toolFolder type.

Fix in Cursor Fix in Web


const oldRp = RPMap.get(folder._id)!;
rpOps.push({
Expand All @@ -112,7 +116,7 @@ async function appSplitMigration(teamId: string) {
teamId
},
update: {
parentId: obj.parentId
parentId: newParentId
}
}
});
Expand Down
Loading