Guard against users putting strings with thousands of periods into custom columns and then saying they are hierarchical

This commit is contained in:
Kovid Goyal 2013-01-29 08:51:09 +05:30
commit 822e80ff7f

View File

@ -188,12 +188,14 @@ class TagTreeItem(object): # {{{
def child_tags(self): def child_tags(self):
res = [] res = []
def recurse(nodes, res): def recurse(nodes, res, depth):
if depth > 100:
return
for t in nodes: for t in nodes:
if t.type != TagTreeItem.CATEGORY: if t.type != TagTreeItem.CATEGORY:
res.append(t) res.append(t)
recurse(t.children, res) recurse(t.children, res, depth+1)
recurse(self.children, res) recurse(self.children, res, 1)
return res return res
# }}} # }}}