mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-11 17:47:44 -05:00
refac
This commit is contained in:
@@ -2757,6 +2757,27 @@ async def process_files_batch(
|
||||
|
||||
for file in form_data.files:
|
||||
try:
|
||||
# Ownership check: verify the requesting user owns the file or is an admin
|
||||
db_file = Files.get_file_by_id(file.id)
|
||||
if not db_file:
|
||||
file_errors.append(
|
||||
BatchProcessFilesResult(
|
||||
file_id=file.id,
|
||||
status="failed",
|
||||
error="File not found",
|
||||
)
|
||||
)
|
||||
continue
|
||||
if db_file.user_id != user.id and user.role != "admin":
|
||||
file_errors.append(
|
||||
BatchProcessFilesResult(
|
||||
file_id=file.id,
|
||||
status="failed",
|
||||
error="Permission denied: not file owner",
|
||||
)
|
||||
)
|
||||
continue
|
||||
|
||||
text_content = file.data.get("content", "")
|
||||
docs: List[Document] = [
|
||||
Document(
|
||||
|
||||
Reference in New Issue
Block a user