mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
py3: fix mobi ncx
get_id_tag/get_id_tag_by_pos_fid are internal functions that always return bytes, but when using the former proxied through the latter, we did not always decode the result in the process of generating an OPF. As a result, books would end up with nav links pointing to urls resembling "foo.html#b'anchor'". Fix by moving down the decode attempt to cover both, right before writing it back into the index_entries.
This commit is contained in:
parent
ab7e134a40
commit
00ed9305cb
@ -391,7 +391,7 @@ class Mobi8Reader(object):
|
|||||||
fi = self.get_file_info(pos)
|
fi = self.get_file_info(pos)
|
||||||
if fi.filename is None:
|
if fi.filename is None:
|
||||||
raise ValueError('Index entry has invalid pos: %d'%pos)
|
raise ValueError('Index entry has invalid pos: %d'%pos)
|
||||||
idtag = self.get_id_tag(pos).decode(self.header.codec)
|
idtag = self.get_id_tag(pos)
|
||||||
href = '%s/%s'%(fi.type, fi.filename)
|
href = '%s/%s'%(fi.type, fi.filename)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
@ -403,7 +403,7 @@ class Mobi8Reader(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
entry['href'] = href
|
entry['href'] = href
|
||||||
entry['idtag'] = idtag
|
entry['idtag'] = idtag.decode(self.header.codec)
|
||||||
|
|
||||||
for e in remove:
|
for e in remove:
|
||||||
index_entries.remove(e)
|
index_entries.remove(e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user