Ticket #25484: static_escape.patch

File static_escape.patch, 662 bytes (added by João Miguel Neves, 9 years ago)

Patch to fix the static lack of escape issue

  • django/templatetags/static.py

    diff --git a/django/templatetags/static.py b/django/templatetags/static.py
    index 7541adb..a40707e 100644
    a b  
    11from django import template
    22from django.utils.encoding import iri_to_uri
     3from django.utils.html import escape
    34from django.utils.six.moves.urllib.parse import urljoin
    45
    56register = template.Library()
    class StaticNode(template.Node):  
    102103    def render(self, context):
    103104        url = self.url(context)
    104105        if self.varname is None:
    105             return url
     106            return escape(url)
    106107        context[self.varname] = url
    107108        return ''
    108109
Back to Top