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:
L1nSn0w 2026-05-08 11:09:52 +08:00
parent 8b07cacb0a
commit 9b5e3ba203

View File

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