mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-26 17:30:27 -04:00
fix: save a file edit made through write access to a shared knowledge base (#30448)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user