#36452: DomainNameValidator forbids digits in TLDs
-------------------------------------+-------------------------------------
Reporter: Shai Berger | Type: Bug
Status: new | Component: Core
| (Other)
Version: dev | Severity: Normal
Keywords: validation domain | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
I think there's a small bug in the domain validator, that has been lurking
quietly for years, and is now biting me a little. The issue is digits in
top-level-domains -- e.g. `email.com1`. As far as I can read the
definition in [https://www.rfc-editor.org/rfc/rfc1035 RFC 1035 (page 8)],
this is a perfectly valid domain name, but
[https://github.com/django/django/blob/2714bc3f2c8675d32caae764c874ac381c836c7f/django/core/validators.py#L82
our regex, as I write this,] allows only letters. This is the regex for
i18n-supporting domains; there's an "ascii_only_tld" regex right next to
it, which does allow digits -- this makes me quite certain that it's a
bug.
Of note: The class `DomainNameValidator` is relatively new - only added
about a year ago -- but it inherits the regex from older `URLValidator`,
which, it seems, has forbidden digits in TLDs at least since Django 2.x.
Since `EmailValidator` now also uses the regexes from
`DomainNameValidator`, it is also affected.
--
Ticket URL: <https://code.djangoproject.com/ticket/36452>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701975b211b2c-f9266d42-f37b-4f2e-934c-4b7fd9b3f5c9-000000%40eu-central-1.amazonses.com.