mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 00:24:09 +02: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
1 changed files with 2 additions and 2 deletions
|
|
@ -391,7 +391,7 @@ def create_ncx(self):
|
|||
fi = self.get_file_info(pos)
|
||||
if fi.filename is None:
|
||||
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)
|
||||
else:
|
||||
try:
|
||||
|
|
@ -403,7 +403,7 @@ def create_ncx(self):
|
|||
continue
|
||||
|
||||
entry['href'] = href
|
||||
entry['idtag'] = idtag
|
||||
entry['idtag'] = idtag.decode(self.header.codec)
|
||||
|
||||
for e in remove:
|
||||
index_entries.remove(e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue