mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 12:59:18 +08:00
refactor(api): drop redundant whitelist filter in _extension_matches
The walrus filter was redundant given the early return on empty input: empty whitelist entries normalize to "" and can never match a non-empty input extension, and empty input is already rejected upfront.
This commit is contained in:
parent
8b07cacb0a
commit
9b5e3ba203
@ -18,7 +18,7 @@ def _extension_matches(extension: str, whitelist: Iterable[str]) -> bool:
|
||||
normalized = _normalize_extension(extension)
|
||||
if not normalized:
|
||||
return False
|
||||
return normalized in {ne for e in whitelist if (ne := _normalize_extension(e))}
|
||||
return normalized in {_normalize_extension(e) for e in whitelist}
|
||||
|
||||
|
||||
def is_file_valid_with_config(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user