diff --git a/django/contrib/staticfiles/templatetags/staticfiles.py b/django/contrib/staticfiles/templatetags/staticfiles.py
index e3bea93..a5a0ef4 100644
|
a
|
b
|
|
| 1 | 1 | from django import template |
| 2 | 2 | from django.contrib.staticfiles.storage import staticfiles_storage |
| | 3 | from django.utils.html import escape |
| 3 | 4 | from django.templatetags.static import StaticNode |
| 4 | 5 | |
| 5 | 6 | register = template.Library() |
| … |
… |
class StaticFilesNode(StaticNode):
|
| 13 | 14 | |
| 14 | 15 | def url(self, context): |
| 15 | 16 | path = self.path.resolve(context) |
| 16 | | return static(path) |
| | 17 | return escape(static(path)) |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | @register.tag('static') |
diff --git a/django/templatetags/static.py b/django/templatetags/static.py
index 7541adb..a40707e 100644
|
a
|
b
|
|
| 1 | 1 | from django import template |
| 2 | 2 | from django.utils.encoding import iri_to_uri |
| | 3 | from django.utils.html import escape |
| 3 | 4 | from django.utils.six.moves.urllib.parse import urljoin |
| 4 | 5 | |
| 5 | 6 | register = template.Library() |
| … |
… |
class StaticNode(template.Node):
|
| 102 | 103 | def render(self, context): |
| 103 | 104 | url = self.url(context) |
| 104 | 105 | if self.varname is None: |
| 105 | | return url |
| | 106 | return escape(url) |
| 106 | 107 | context[self.varname] = url |
| 107 | 108 | return '' |
| 108 | 109 | |