simplify logic

This commit is contained in:
Juan Calderon-Perez 2025-04-08 00:44:47 -04:00 committed by GitHub
parent 353b104c77
commit 7c1b004687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(