mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:24:20 +02:00
EPUB Output: Fix crash caused by ids with non-ascii characters in them
This commit is contained in:
parent
37ddce4074
commit
5c219da8d3
1 changed files with 13 additions and 1 deletions
|
|
@ -120,7 +120,19 @@ def find_page_breaks(self, item):
|
|||
for i, x in enumerate(page_breaks):
|
||||
x.set('id', x.get('id', 'calibre_pb_%d'%i))
|
||||
id = x.get('id')
|
||||
page_breaks_.append((XPath('//*[@id=%r]'%id),
|
||||
try:
|
||||
xp = XPath('//*[@id="%s"]'%id)
|
||||
except:
|
||||
try:
|
||||
xp = XPath("//*[@id='%s']"%id)
|
||||
except:
|
||||
# The id has both a quote and an apostrophe or some other
|
||||
# Just replace it since I doubt its going to work anywhere else
|
||||
# either
|
||||
id = 'calibre_pb_%d'%i
|
||||
x.set('id', id)
|
||||
xp = XPath('//*[@id=%r]'%id)
|
||||
page_breaks_.append((xp,
|
||||
x.get('pb_before', False)))
|
||||
page_break_ids.append(id)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue