Skip to content
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

Closed
henriklindgren opened this issue Sep 9, 2019 · 4 comments
Closed
Labels
bug help wanted

Comments

@henriklindgren
Copy link
Contributor

@henriklindgren henriklindgren commented Sep 9, 2019

Bug

EmailStr validate-method performs lower() on whole string including local part, violating RFC 5321 by not conforming to

The local-part of a mailbox MUST BE treated as case sensitive.
https://tools.ietf.org/rfc/rfc5321.txt

See

return name or email[: email.index('@')], email.lower()

  • OS: Any
  • Python version import sys; print(sys.version): Any
  • Pydantic version import pydantic; print(pydantic.VERSION): 0.32.2

Where possible please include a self contained code snippet describing your bug:

import pydantic
assert pydantic.EmailStr.validate('AbC@example.com') == 'AbC@example.com'
@samuelcolvin
Copy link
Owner

@samuelcolvin samuelcolvin commented Sep 9, 2019

Thanks for reporting, PR welcome to fix this.

@dmontagu
Copy link
Collaborator

@dmontagu dmontagu commented Oct 7, 2019

Closing as it looks like this was addressed by #801. Thanks for the contribution @henriklindgren!

@dmontagu dmontagu closed this as completed Oct 7, 2019
@slavugan
Copy link

@slavugan slavugan commented Apr 5, 2021

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.

@emilpaw
Copy link

@emilpaw emilpaw commented Apr 8, 2021

Is there a simple way to get the old behavior back?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted
Projects
None yet
Development

No branches or pull requests

5 participants