From e937c8a0de02bbbb5f19f9a65e0f2f9a0ffb6446 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Mon, 19 Mar 2018 14:17:35 -0500 Subject: [PATCH] Fix cases where filter input is not a Markup type The previous commit assumes that the filter will always be a Markup type, which is not correct. --- jinja2/filters.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jinja2/filters.py b/jinja2/filters.py index 79505fbe..ab02ca3c 100644 --- a/jinja2/filters.py +++ b/jinja2/filters.py @@ -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 -- 2.47.2