diff options
| author | Alasdair Nicol <alasdair@thenicols.net> | 2016-09-19 21:18:41 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-09-19 21:01:09 -0400 |
| commit | 190cd0e49f967d2ec0b6c50a63f0d58d13319611 (patch) | |
| tree | ea42e7a9ab3a431f6ce5d99449e008a4faf7dd5f /django | |
| parent | 9c3f8643058958d591a68d33984db6f3e226b11f (diff) | |
[1.10.x] Fixed #27238 -- Disabled check_pattern_startswith_slash if settings.APPEND_SLASH=False.
Thanks strycore for the report and timgraham for suggesting the
solution.
Backport of 911d9f4ed1a39f945769b7198a419850378f9824 from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/checks/urls.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/core/checks/urls.py b/django/core/checks/urls.py index 8356fc2f00..c151c491dc 100644 --- a/django/core/checks/urls.py +++ b/django/core/checks/urls.py @@ -95,6 +95,10 @@ def check_pattern_startswith_slash(pattern): Check that the pattern does not begin with a forward slash. """ regex_pattern = pattern.regex.pattern + if not settings.APPEND_SLASH: + # Skip check as it can be useful to start a URL pattern with a slash + # when APPEND_SLASH=False. + return [] if regex_pattern.startswith('/') or regex_pattern.startswith('^/'): warning = Warning( "Your URL pattern {} has a regex beginning with a '/'. Remove this " |
