mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-29 00:21:45 -05:00
refac: only accept own folders as the new parent when moving a folder (#34978)
Moving a folder now only accepts a parent folder the user owns.
This commit is contained in:
1 parent
bf616b21df
commit
d64df861a2
1 file changed
+6
@@ -534,6 +534,12 @@ async def update_folder_parent_id_by_id(
|
||||
detail=ERROR_MESSAGES.DEFAULT('Folder already exists'),
|
||||
)
|
||||
|
||||
if form_data.parent_id and not await Folders.get_folder_by_id_and_user_id(form_data.parent_id, user.id, db=db):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
|
||||
)
|
||||
|
||||
if form_data.parent_id and form_data.parent_id in await Folders.get_folder_ids_by_id_and_user_id_in_subtree(
|
||||
id, user.id, db=db
|
||||
):
|
||||
|
||||
Reference in new issue
Block a user