mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Modified the ".as_" method in the magic filter class to correctly handle values that are interpreted as `False` such as `0`. Previously, the method incorrectly dismissed these valid values. The issue was identified and fixed to ensure correct handling of all valid data inputs.
This commit is contained in:
parent
bff2ed0a86
commit
ee8e457c5f
3 changed files with 17 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Any
|
||||
from typing import Any, Iterable
|
||||
|
||||
from magic_filter import MagicFilter as _MagicFilter
|
||||
from magic_filter import MagicT as _MagicT
|
||||
|
|
@ -12,7 +12,7 @@ class AsFilterResultOperation(BaseOperation):
|
|||
self.name = name
|
||||
|
||||
def resolve(self, value: Any, initial_value: Any) -> Any:
|
||||
if not value:
|
||||
if value is None or (isinstance(value, Iterable) and not value):
|
||||
return None
|
||||
return {self.name: value}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue