summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDheerendra Rathor <dheeru.rathor14@gmail.com>2015-10-30 03:19:10 +0530
committerTim Graham <timograham@gmail.com>2015-10-31 17:50:05 -0400
commit06627ef2caa6854540b50b6f6309c7d12ccfb56a (patch)
tree235006242affd515d325e936f1acc5ba711ed33b
parent5ce84b8044b87b77eff329ed808e8be493a7cfe6 (diff)
Fixed #25635 -- Made URLValidator allow '+' in scheme.
-rw-r--r--django/core/validators.py2
-rw-r--r--tests/validators/tests.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 69cc76ffab..15b16bcd2f 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -89,7 +89,7 @@ class URLValidator(RegexValidator):
host_re = '(' + hostname_re + domain_re + tld_re + '|localhost)'
regex = _lazy_re_compile(
- r'^(?:[a-z0-9\.\-]*)://' # scheme is validated separately
+ r'^(?:[a-z0-9\.\-\+]*)://' # scheme is validated separately
r'(?:\S+(?::\S*)?@)?' # user:pass authentication
r'(?:' + ipv4_re + '|' + ipv6_re + '|' + host_re + ')'
r'(?::\d{2,5})?' # port
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index f696f8e573..ad82eb6132 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -22,7 +22,7 @@ from django.test.utils import str_prefix
from django.utils._os import upath
NOW = datetime.now()
-EXTENDED_SCHEMES = ['http', 'https', 'ftp', 'ftps', 'git', 'file']
+EXTENDED_SCHEMES = ['http', 'https', 'ftp', 'ftps', 'git', 'file', 'git+ssh']
TEST_DATA = [
# (validator, value, expected),
@@ -205,6 +205,7 @@ TEST_DATA = [
(URLValidator(EXTENDED_SCHEMES), 'file://localhost/path', None),
(URLValidator(EXTENDED_SCHEMES), 'git://example.com/', None),
+ (URLValidator(EXTENDED_SCHEMES), 'git+ssh://git@github.com/example/hg-git.git', None),
(URLValidator(EXTENDED_SCHEMES), 'git://-invalid.com', ValidationError),
# Trailing newlines not accepted