-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Email parse IndexError <""@wiarcom.com> #72118
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
Comments
Email lib fails to parse some emails: from email._header_value_parser import get_angle_addr get_angle_addr('<""@wiarcom.com> SIZE=28113').addr_spec IndexError: list index out of range Seems that email address can be parsed. |
Looking at the spec this is a valid angle addr. Not only et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].addr_spec but also et_angle_addr('<""@wiarcom.com> SIZE=28113')[0].local_part fails for the same reason. The problem exists in get_bare_quoted_string. When encounter bare '""', it returns a empty BareQuoteString. I write bpo-27931.patch to fix this. |
You are correct, it is technically a valid angleaddr. I'll review this next week, the patch looks good (thanks) but I need to double check a couple things before I commit. |
It should be. If there is anything wrong I'd like to hear and fix. |
Ping this and hope you don't forget about it David. :) |
Reviewed. There is something else that needs fixing. The address needs to re-render as ""@wiarcom.com, which it doesn't currently. I scanned the rendering code in _header_value_registry quickly and its not obvious to me why it doesn't work, so it may be a bug in the headerregistry.Address object. I'm uploading the patch with the added test. |
You are right David. But I don't understand what it has to do with headerregistry. I update my original patch to get that behaviour, limit it the affection in angleaddr. Now seems everything is fine. >>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].local_part
''
>>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].domain
'wiarcom.com'
>>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].route
>>> email._header_value_parser.get_angle_addr('<""@wiarcom.com> SIZE=28113')[0].addr_spec
'""@wiarcom.com' |
Ping. |
ping |
1 similar comment
ping |
#5329 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: