From b1ef53873fa3adccd0a5a1b68e5b638316e40248 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Date: Tue, 15 Apr 2025 08:53:05 -0400 Subject: [PATCH] Check if content is present before removing --- backend/open_webui/routers/files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index 8a2888d86..5907b69f4 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -173,7 +173,8 @@ async def list_files(user=Depends(get_verified_user), content: bool = Query(True if not content: for file in files: - del file.data["content"] + if "content" in file.data: + del file.data["content"] return files @@ -214,7 +215,8 @@ async def search_files( if not content: for file in matching_files: - del file.data["content"] + if "content" in file.data: + del file.data["content"] return matching_files