]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Fix cases where filter input is not a Markup type
authorErik Johnson <palehose@gmail.com>
Mon, 19 Mar 2018 19:17:35 +0000 (14:17 -0500)
committerErik Johnson <palehose@gmail.com>
Mon, 19 Mar 2018 19:17:35 +0000 (14:17 -0500)
The previous commit assumes that the filter will always be a Markup
type, which is not correct.

jinja2/filters.py

index 79505fbe72961c5359b13ed3fbf05efabc1c9dc2..ab02ca3cbd0668826675ad34603164841f3f3dd5 100644 (file)
@@ -567,8 +567,12 @@ def do_indent(
             rv += u'\n' + u'\n'.join(
                 indention + line if line else line for line in lines
             )
-            # Unescape any strings that were escaped due to concatenation
-            rv = Markup(rv.unescape())
+            try:
+                # Unescape any strings that were escaped due to concatenation
+                rv = Markup(rv.unescape())
+            except AttributeError:
+                # s was not a Markup instance
+                pass
 
     if first:
         rv = indention + rv