mirror of
https://github.com/open-webui/open-webui.git
synced 2026-04-30 09:18:50 -05:00
refac
This commit is contained in:
@@ -2757,6 +2757,27 @@ async def process_files_batch(
|
|||||||
|
|
||||||
for file in form_data.files:
|
for file in form_data.files:
|
||||||
try:
|
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", "")
|
text_content = file.data.get("content", "")
|
||||||
docs: List[Document] = [
|
docs: List[Document] = [
|
||||||
Document(
|
Document(
|
||||||
|
|||||||
Reference in New Issue
Block a user