Fixed #26578 -- Prohibited non-ASCII digits in validate_ipv4_address.

This commit is contained in:
wim glenn 2016-10-28 10:38:49 -05:00 committed by Tim Graham
parent 1bc249c2a6
commit 21dd792349
2 changed files with 2 additions and 1 deletions

View File

@ -252,7 +252,7 @@ validate_unicode_slug = RegexValidator(
'invalid'
)
ipv4_re = _lazy_re_compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\Z')
ipv4_re = _lazy_re_compile(r'^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])){3}\Z')
validate_ipv4_address = RegexValidator(ipv4_re, _('Enter a valid IPv4 address.'), 'invalid')

View File

@ -138,6 +138,7 @@ TEST_DATA = [
(validate_ipv4_address, '25,1,1,1', ValidationError),
(validate_ipv4_address, '25.1 .1.1', ValidationError),
(validate_ipv4_address, '1.1.1.1\n', ValidationError),
(validate_ipv4_address, '٧.2٥.3٣.243', ValidationError),
# validate_ipv6_address uses django.utils.ipv6, which
# is tested in much greater detail in its own testcase