Skip to content

Commit 4cb3e90

Browse files
authored
fix: prevent folder items from moving into collection (#1113)
1 parent 062f38a commit 4cb3e90

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apps/studio/src/server/modules/resource/resource.router.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,17 @@ export const resourceRouter = router({
294294
})
295295
}
296296

297+
if (
298+
parent.type === ResourceType.Collection &&
299+
toMove.type !== ResourceType.CollectionPage &&
300+
toMove.type !== ResourceType.CollectionLink
301+
) {
302+
throw new TRPCError({
303+
code: "BAD_REQUEST",
304+
message: "Folder items can only be moved to another folder",
305+
})
306+
}
307+
297308
if (movedResourceId === destinationResourceId) {
298309
throw new TRPCError({ code: "BAD_REQUEST" })
299310
}

0 commit comments

Comments
 (0)