Convert an uuid.UUID
variable into int
when pass it in params
#1458
Labels
uuid.UUID
variable into int
when pass it in params
#1458
Please confirm the following
vulnerability, to the best of my knowledge. (These must be shared by
submitting this report form instead, if
any hesitation exists.)
Describe the bug
I've defined a pydantic model (let's call it
User
) as the input model of my view function, which has a field annotated as uuid.UUID nameduser_id
.When I pass user.user_id as a part of params in a request(use aiohttp), yarl will convert the type of uuid.UUID into int before cast it into string.
For example: uuid.UUID('3199712f-1b78-4420-852b-a73ee09e6a8f') -> '65928888857327045292976149998723820175'
by this line: https://github.com/aio-libs/yarl/blob/master/yarl/_query.py#L35
So i've change my code to check every param in params if it's instance of uuid.UUID.
I came here to ask if this conversion behavior is as expected? Is there a better compatibility implementation?
To Reproduce
as description above
Expected behavior
as description above
Logs/tracebacks
Python Version
multidict Version
propcache Version
yarl Version
OS
linux or macos
Additional context
No response
The text was updated successfully, but these errors were encountered: