mbr / flask-bootstrap

Ready-to-use Twitter-bootstrap for use in Flask.
http://pypi.python.org/pypi/Flask-Bootstrap
Other
1.58k stars 724 forks source link

Fixed malformatted <span> tag in `icon` macro #207

Closed mcculloh213 closed 3 years ago

mcculloh213 commented 3 years ago

Hardly even noticeable, but I discovered a very niche bug when the browsepy Flask template streamer crashed whenever it would attempt to compile the following line in any template:

{%- import "bootstrap/utils.py" as utils -%}

I was left scratching my head trying to figure out where the root of the issue was. I took a closer look at the source for the file, noticed the malformatted span in the macro:

{% macro icon(type=None, extra_classes=[]) -%}
<span{{ ({'class': (['glyphicon', 'glyphicon-' + type] + extra_classes)|join(' ')})|xmlattr}}{{kwargs|xmlattr}}></span>
{%- endmacro %}

I was able to close the tag, test it out, and confirm that is was the missing > from the tag was enough to break parser used to chunk the template into a streaming response.