summaryrefslogtreecommitdiff
path: root/django/urls
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2019-08-20 11:53:10 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-08-20 11:53:10 +0200
commit22394bd3a18a7d9a8957a0b431f8ae4e5ca03a8c (patch)
treed805e278a5519ebf7d0da3c74ddb3775fefae0f5 /django/urls
parentcece802dbb021f92802be74c8ff9ac87976441ff (diff)
Fixed #29667 -- Prohibited whitespaces in path() URLs.
Diffstat (limited to 'django/urls')
-rw-r--r--django/urls/resolvers.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
index 2154a46320..2ff8b2c775 100644
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -8,6 +8,7 @@ attributes of the resolved URL match.
import functools
import inspect
import re
+import string
from importlib import import_module
from urllib.parse import quote
@@ -206,6 +207,8 @@ def _route_to_regex(route, is_endpoint=False):
For example, 'foo/<int:pk>' returns '^foo\\/(?P<pk>[0-9]+)'
and {'pk': <django.urls.converters.IntConverter>}.
"""
+ if not set(route).isdisjoint(string.whitespace):
+ raise ImproperlyConfigured("URL route '%s' cannot contain whitespace." % route)
original_route = route
parts = ['^']
converters = {}