New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EmailStr is not case-sensitive on local part of email per RFC 5321 #798
Comments
Thanks for reporting, PR welcome to fix this. |
Closing as it looks like this was addressed by #801. Thanks for the contribution @henriklindgren! |
this RFC 5321 looks outdated as most email services works with emails as case insensitive, and following this RFC just complicates our life. just IMHO. |
Is there a simple way to get the old behavior back? |
If you want case insensitive email, inherit EmailStr and convert the value to lowercase.
Note: validate method overrode the EmailStr's validate method. That's why had to include the lines of the EmailStr validation. |
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
It's now called https://github.com/pydantic/pydantic/blob/main/pydantic/networks.py#L418 |
Bug
EmailStr validate-method performs lower() on whole string including local part, violating RFC 5321 by not conforming to
See
https://github.com/samuelcolvin/pydantic/blob/79017111aa030873f2dc54576e2c768d154b1be5/pydantic/networks.py#L383
import sys; print(sys.version)
: Anyimport pydantic; print(pydantic.VERSION)
: 0.32.2Where possible please include a self contained code snippet describing your bug:
The text was updated successfully, but these errors were encountered: