mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
Protect against nameless HTML tags in tools/lib/template_parser.py.
Fixed IndexError when there is only zero or more whitespace characters between < and >. (str.split() will return an empty list in this case, which means there is no index 0.)
This commit is contained in:
@@ -69,7 +69,13 @@ def tokenize(text):
|
||||
while state.i < len(text):
|
||||
if looking_at_html_start():
|
||||
s = get_html_tag(text, state.i)
|
||||
tag = s[1:-1].split()[0]
|
||||
tag_parts = s[1:-1].split()
|
||||
|
||||
if not tag_parts:
|
||||
raise TemplateParserException("Tag name missing")
|
||||
|
||||
tag = tag_parts[0]
|
||||
|
||||
if is_special_html_tag(s, tag):
|
||||
kind = 'html_special'
|
||||
elif s.endswith('/>'):
|
||||
|
||||
Reference in New Issue
Block a user