mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2825 ("No such file or directory" error in viewer)
This commit is contained in:
parent
f930919523
commit
cf818b1c62
@ -1963,6 +1963,11 @@ class MobiWriter(object):
|
||||
self._oeb.logger.warn(' Ignoring TOC entry with no href:',
|
||||
child.title)
|
||||
continue
|
||||
if h not in self._id_offsets:
|
||||
self._oeb.logger.warn(' Ignoring missing TOC entry:',
|
||||
child)
|
||||
continue
|
||||
|
||||
currentOffset = self._id_offsets[h]
|
||||
# print "_generate_ctoc: child offset: 0x%X" % currentOffset
|
||||
|
||||
|
@ -41,9 +41,12 @@ class SpineItem(unicode):
|
||||
|
||||
def __new__(cls, *args):
|
||||
args = list(args)
|
||||
args[0] = args[0].partition('#')[0]
|
||||
obj = super(SpineItem, cls).__new__(cls, *args)
|
||||
path = args[0]
|
||||
ppath = path.partition('#')[0]
|
||||
if not os.path.exists(path) and os.path.exists(ppath):
|
||||
path = ppath
|
||||
args[0] = path
|
||||
obj = super(SpineItem, cls).__new__(cls, *args)
|
||||
raw = open(path, 'rb').read()
|
||||
raw, obj.encoding = xml_to_unicode(raw)
|
||||
obj.character_count = character_count(raw)
|
||||
|
Loading…
x
Reference in New Issue
Block a user