From 7c1b0046874ae7182c443ab91246c1e384eafb21 Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Date: Tue, 8 Apr 2025 00:44:47 -0400 Subject: [PATCH] simplify logic --- backend/open_webui/routers/files.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/open_webui/routers/files.py b/backend/open_webui/routers/files.py index 1c1c1657e..c16870e9b 100644 --- a/backend/open_webui/routers/files.py +++ b/backend/open_webui/routers/files.py @@ -205,12 +205,8 @@ async def search_files( # Retrieve files from cache files = get_all_files_for_user(user.id, user.role == "admin") - # Normalize pattern and file names - normalized_pattern = normalize_text(filename).lower() - matching_files = [ - file for file in files - if fnmatch(normalize_text(file.filename).lower(), normalized_pattern) - ] + # Get matching files + matching_files = [file for file in files if fnmatch(file.filename.lower(), filename.lower())] if not matching_files: raise HTTPException(