1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.8.x] Fixed #25059 -- Allowed Punycode TLDs in URLValidator

Backport of bc98bc56a5 from master
This commit is contained in:
Alexey Sveshnikov
2015-07-03 19:35:55 +03:00
committed by Tim Graham
parent 73cbf08159
commit 8c417564c7
5 changed files with 7 additions and 1 deletions

View File

@@ -74,7 +74,7 @@ class URLValidator(RegexValidator):
# Host patterns
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]+(?:[a-z' + ul + r'0-9-]*[a-z' + ul + r'0-9]+)*)*'
tld_re = r'\.[a-z' + ul + r']{2,}\.?'
tld_re = r'\.(?:[a-z' + ul + r']{2,}|xn--[a-z0-9]+)\.?'
host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
regex = re.compile(