Skip to content

Allow single character host labels in email addresses - #2985

Open
OlegPhenomenon wants to merge 1 commit into
masterfrom
fix/allow-single-char-email-host-labels
Open

OlegPhenomenon wants to merge 1 commit into
masterfrom
fix/allow-single-char-email-host-labels

Conversation

@OlegPhenomenon

Copy link
Copy Markdown
Contributor

Closes #2959

Problem

config.email_pattern in config/initializers/truemail.rb required every host label to be at least 2 characters ([\p{L}0-9][\p{L}0-9-]{0,61}[\p{L}0-9]), so addresses like smth@e.ee or smth@a.domain.ee failed regex validation.

Change

  • Host label is now [\p{L}0-9](?:[\p{L}0-9-]{0,61}[\p{L}0-9])?: 1 to 63 chars, no leading/trailing hyphen.
  • TLD unchanged: 2-63 letters, so smth@domain.e is still rejected.

Tests

test/interactions/email_check_test.rb covers the new valid cases (smth@e.ee, smth@a.domain.ee, smth@sub.b.domain.ee, smth@1.ee) and invalid ones (smth@domain.e, smth@a.domain.e, smth@-.ee, smth@a-.ee).

Ran locally: email_check, contact, EPP contact create, email verification force delete, verify emails job tests: 60 runs, 0 failures.

- Truemail email_pattern accepted only 2+ char host labels, rejecting smth@e.ee and smth@a.domain.ee
- Allow 1 char labels at every level except TLD, which stays 2-63 letters

Closes #2959

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow 1 character domains in email addresses

2 participants