mirror of
https://git.mirrors.martin98.com/https://github.com/open-webui/open-webui
synced 2025-08-19 18:29:06 +08:00
simplify logic
This commit is contained in:
parent
353b104c77
commit
7c1b004687
@ -205,12 +205,8 @@ async def search_files(
|
|||||||
# Retrieve files from cache
|
# Retrieve files from cache
|
||||||
files = get_all_files_for_user(user.id, user.role == "admin")
|
files = get_all_files_for_user(user.id, user.role == "admin")
|
||||||
|
|
||||||
# Normalize pattern and file names
|
# Get matching files
|
||||||
normalized_pattern = normalize_text(filename).lower()
|
matching_files = [file for file in files if fnmatch(file.filename.lower(), filename.lower())]
|
||||||
matching_files = [
|
|
||||||
file for file in files
|
|
||||||
if fnmatch(normalize_text(file.filename).lower(), normalized_pattern)
|
|
||||||
]
|
|
||||||
|
|
||||||
if not matching_files:
|
if not matching_files:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user