fix: list filter node url not work (#9540)

This commit is contained in:
非法操作 2024-10-21 15:32:28 +08:00 committed by GitHub
parent 7742a5dac2
commit 53b14bde4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -122,7 +122,7 @@ def _get_file_extract_string_func(*, key: str) -> Callable[[File], str]:
return lambda x: x.mime_type or ""
case "transfer_method":
return lambda x: x.transfer_method
case "urL":
case "url":
return lambda x: x.remote_url or ""
case _:
raise ValueError(f"Invalid key: {key}")
@ -249,7 +249,7 @@ def _order_string(*, order: Literal["asc", "desc"], array: Sequence[str]):
def _order_file(*, order: Literal["asc", "desc"], order_by: str = "", array: Sequence[File]):
if order_by in {"name", "type", "extension", "mime_type", "transfer_method", "urL"}:
if order_by in {"name", "type", "extension", "mime_type", "transfer_method", "url"}:
extract_func = _get_file_extract_string_func(key=order_by)
return sorted(array, key=lambda x: extract_func(x), reverse=order == "desc")
elif order_by == "size":