mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Ensure base type validation can handle non-dictionary values
The update introduces a condition to verify whether the values being validated are a dictionary before attempting to handle UNSET_TYPE in the aiogram base type. This adjustment helps to prevent potential errors or incorrect validation when non-dictionary values are faced.
This commit is contained in:
parent
e1be9dd668
commit
fffc2b2d9e
1 changed files with 2 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ class TelegramObject(BotContextController, BaseModel):
|
|||
but UNSET might be passed to a model initialization from `Bot.method_name`,
|
||||
so we must take care of it and remove it before fields validation.
|
||||
"""
|
||||
if not isinstance(values, dict):
|
||||
return values
|
||||
return {k: v for k, v in values.items() if not isinstance(v, UNSET_TYPE)}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue