https://code.djangoproject.com/ticket/30924#ticket
The current regex in ​URLValidator does not allow numbers in the top-level
domain
e.g. www.example.org33 raises a ValidationError
Rarely, if ever, do public top-level domains contain a number, however
internal, private networks can certainly be configured with numbers present
in the top-level domain. Thus it is important to handle these URLs without
having to specify custom regex patterns to pass into the URLValidator.
The change can be achieved by replacing the following line in the
URLValidator class:
r'(?:[a-z' + ul + '-]{2,63}'
with
r'(?:[a-z' + ul + r'0-9' + '-]{2,63}'
To note, the proposed change above does allow for addresses like
http://1.1.1.1.1
http://123.123.123
which are currently listed under invalid_urls.txt
<https://github.com/django/django/blob/f57e174fa61e4c31213f6d0033fb9d647b463626/tests/validators/invalid_urls.txt#L45>
I think the rationale for allowing dashes in the top level domain (
https://code.djangoproject.com/ticket/25452#comment:2) can be applied to
this case as well.
I am hoping this post can generate some insightful discussion around this
topic. Thanks!
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/007a2765-f906-4db9-b77f-ecf9fb8fbb2a%40googlegroups.com.