Skip to content

Commit

Permalink
fix bottlepy#1155: Catastrophic backtracking issue in template parser.
Browse files Browse the repository at this point in the history
Related to bottlepy#1194

This backports the patch from 332215b to the 0.12 release branch.

This fix can be validated using the following repl commands:

    >>> import bottle
    >>> bottle.template("""<img src="{{usar_webp(''/static/images/branco400.jpg')}}" alt="Sem imagem"/>""")
  • Loading branch information
kujenga committed Nov 1, 2022
1 parent b9c4274 commit b1127d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3486,7 +3486,7 @@ class StplParser(object):
# Match the start tokens of code areas in a template
_re_split = '(?m)^[ \t]*(\\\\?)((%(line_start)s)|(%(block_start)s))(%%?)'
# Match inline statements (may contain python strings)
_re_inl = '(?m)%%(inline_start)s((?:%s|[^\'"\n]*?)+)%%(inline_end)s' % _re_inl
_re_inl = '(?m)%%(inline_start)s((?:%s|[^\'"\n])*?)%%(inline_end)s' % _re_inl
_re_tok = '(?m)' + _re_tok

default_syntax = '<% %> % {{ }}'
Expand Down

0 comments on commit b1127d6

Please sign in to comment.