mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a regression in calibre 5 that broke processing of some PDB files with images. Fixes #1901957 [E-book viewer: can't open a .pdb file](https://bugs.launchpad.net/calibre/+bug/1901957)
This commit is contained in:
parent
35df1312a2
commit
b7bb73e40e
@ -13,9 +13,9 @@ import struct
|
|||||||
|
|
||||||
from calibre import CurrentDir
|
from calibre import CurrentDir
|
||||||
from calibre.ebooks.metadata.opf2 import OPFCreator
|
from calibre.ebooks.metadata.opf2 import OPFCreator
|
||||||
from calibre.ebooks.pdb.formatreader import FormatReader
|
|
||||||
from calibre.ebooks.pdb.ereader import EreaderError
|
from calibre.ebooks.pdb.ereader import EreaderError
|
||||||
from polyglot.builtins import unicode_type, range
|
from calibre.ebooks.pdb.formatreader import FormatReader
|
||||||
|
from polyglot.builtins import as_unicode, range, unicode_type
|
||||||
|
|
||||||
|
|
||||||
class HeaderRecord(object):
|
class HeaderRecord(object):
|
||||||
@ -116,6 +116,7 @@ class Reader202(FormatReader):
|
|||||||
for i in range(self.header_record.non_text_offset, len(self.sections)):
|
for i in range(self.header_record.non_text_offset, len(self.sections)):
|
||||||
name, img = self.get_image(i)
|
name, img = self.get_image(i)
|
||||||
if name:
|
if name:
|
||||||
|
name = as_unicode(name)
|
||||||
images.append(name)
|
images.append(name)
|
||||||
with open(name, 'wb') as imgf:
|
with open(name, 'wb') as imgf:
|
||||||
self.log.debug('Writing image %s to images/' % name)
|
self.log.debug('Writing image %s to images/' % name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user