diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2015-07-21 13:35:11 +0100 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2015-07-21 14:04:58 +0100 |
| commit | 8a5eadd140a5f06d24e1c5bc0c444ce11be0769a (patch) | |
| tree | 49c9b7de125e971593e14f01281019ad884764b6 /django | |
| parent | 927b30a6ab33ea33e5e3b1e7408ac1d5d267ff6a (diff) | |
Corrected HTML-escaping behaviour of url template tag.
Due to the URL encoding applied by the tag for all parameters that might be
partly controllable by an end-user, there are no XSS/security problems
caused by this bug, only invalid HTML.
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/defaulttags.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index b0501505b5..90bdbc25d0 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -12,7 +12,7 @@ from django.conf import settings from django.utils import six, timezone from django.utils.deprecation import RemovedInDjango110Warning from django.utils.encoding import force_text, smart_text -from django.utils.html import format_html +from django.utils.html import conditional_escape, format_html from django.utils.lorem_ipsum import paragraphs, words from django.utils.safestring import mark_safe @@ -512,6 +512,8 @@ class URLNode(Node): context[self.asvar] = url return '' else: + if context.autoescape: + url = conditional_escape(url) return url |
