mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Guard against users putting strings with thousands of periods into custom columns and then saying they are hierarchical
This commit is contained in:
commit
822e80ff7f
@ -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
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user