#25620: URLValidator regex does not trigger on consecutive periods
------------------------------+--------------------------------------
Reporter: sully90h | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by DheerendraRathor):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Here are the relevant code part from URLValidator (this is from the master
branch)
{{{
hostname_re = r'[a-z' + ul + r'0-9](?:[a-z' + ul + r'0-9-]*[a-z' + ul +
r'0-9])?'
domain_re = r'(?:\.(?!-)[a-z' + ul + r'0-9-]*(?<!-))*'
tld_re = r'\.(?:[a-z' + ul + r']{2,}|xn--[a-z0-9]+)\.?'
host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
}}}
The culprit is domain_re which allows multiple dots due to '*' on [a-z0-9]
part. Changing * to + should solve the problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/25620#comment:1>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.255cf692cf9eb0587b911a174972f2cd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.