fix: save a file edit made through write access to a shared knowledge base (#30448)

This commit is contained in:
G30
2026-09-23 23:05:37 -05:00
committed by GitHub
parent 5f8d8f0c5e
commit a046e07044
+4 -4
View File
@@ -1936,10 +1936,10 @@ async def process_file(
The session is committed before external API calls, and updates use a fresh session.
"""
config = await get_retrieval_config()
if user.role == 'admin':
file = await Files.get_file_by_id(form_data.file_id, db=db)
else:
file = await Files.get_file_by_id_and_user_id(form_data.file_id, user.id, db=db)
file = await Files.get_file_by_id(form_data.file_id, db=db)
if file and file.user_id != user.id and user.role != 'admin':
if not await has_access_to_file(file.id, 'write', user, db=db):
file = None
if file:
try: