Repository navigation
fix(email, url): accept quoted pairs with any visible character again - #585
Open
yuchengshen931122-creator wants to merge 1 commit into
Open
yuchengshen931122-creator wants to merge 1 commit into
yuchengshen931122-creator wants to merge 1 commit into
Conversation
af69a68 changed the quoted-pair class from `\[\001-\011\013\014\016-\177]` to `\[\011.]`. Inside a character class `.` is a literal dot, so only backslash-TAB and backslash-dot were accepted and `"a\\"b"@example.com` was rejected. Restore the previous class (the one Django uses); escaped LF/CR stay invalid, so existing expectations are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #582.
What
af69a68 changed the quoted-pair class in the local-part regex from
\\[\001-\011\013\014\016-\177]to\\[\011.]. Inside[...]the.is a literal dot, so only backslash-TAB and backslash-dot were accepted and"a\"b"@example.comwas rejected. This restores the previous class (the one Django uses) inemail.pyand inurl.py(_username_regex, same change in the same commit).Behaviour
"a\"b","a\\b","\a","a\ b"as local parts: now valid (RFC 5322 §3.2.1,quoted-pair = "\" (VCHAR / WSP))."\<TAB>"stays valid,"\<LF>"and"\<CR>"stay invalid (test_returns_failed_validation_on_invalid_email).Tests
test_accepts_quoted_pair_with_any_visible_character(4 cases) – fails on master, passes with this change.uv run pytest .(1,578 passed),ruff format .,ruff check .,pyright .(0 errors).Found while writing specification-based tests for a university software-testing project (NYCU). The change and this description were prepared with the help of an AI assistant (Claude Code).
🤖 Generated with Claude Code