fix: keep a cloned chat in a shared folder the user can write to (#31370)

This commit is contained in:
G30 2026-09-30 11:59:11 -04:00 • committed by GitHub
parent c7caa1421d
commit d4d04dca0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -660,11 +660,13 @@ class ChatTable:
db: AsyncSession | None = None,
) -> list[ChatModel]:
async with get_async_db_context(db) as session:
from open_webui.utils.access_control.folders import has_folder_write_access
# Validate folder_id references — clear any that don't exist
folder_ids = {f.folder_id for f in chat_import_forms if f.folder_id}
existing = set()
for fid in folder_ids:
if await Folders.get_folder_by_id_and_user_id(fid, user_id, db=session):
if await has_folder_write_access(user_id, fid, db=session):
existing.add(fid)
cleared = 0