mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Edit Book: Fix a crash in the Insert Link tool if one of the HTML files contains an empty id. Fixes #1580928 [id=""](https://bugs.launchpad.net/calibre/+bug/1580928)
This commit is contained in:
parent
5c3e43da0f
commit
88ff4ae126
@ -670,6 +670,8 @@ class InsertLink(Dialog):
|
||||
ac = self.anchor_cache[name] = []
|
||||
for item in set(root.xpath('//*[@id]')) | set(root.xpath('//h:a[@name]', namespaces={'h':XHTML_NS})):
|
||||
frag = item.get('id', None) or item.get('name')
|
||||
if not frag:
|
||||
continue
|
||||
text = lead_text(item, num_words=4)
|
||||
ac.append((text, frag))
|
||||
ac.sort(key=lambda text_frag: primary_sort_key(text_frag[0]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user