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

This commit is contained in:
G30 2026-09-24 00:05:37 -04:00 • committed by GitHub
parent 5f8d8f0c5e
commit a046e07044
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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: