mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
EPUB Output: Fix crash caused by ids with non-ascii characters in them
This commit is contained in:
parent
37ddce4074
commit
5c219da8d3
@ -120,7 +120,19 @@ class Split(object):
|
|||||||
for i, x in enumerate(page_breaks):
|
for i, x in enumerate(page_breaks):
|
||||||
x.set('id', x.get('id', 'calibre_pb_%d'%i))
|
x.set('id', x.get('id', 'calibre_pb_%d'%i))
|
||||||
id = x.get('id')
|
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)))
|
x.get('pb_before', False)))
|
||||||
page_break_ids.append(id)
|
page_break_ids.append(id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user