mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
MOBI metadata reader: Handle invalid PRC files with spurious image_offset headers
This commit is contained in:
parent
a9ffac7885
commit
491d1a8954
@ -861,7 +861,10 @@ def get_metadata(stream):
|
|||||||
cover_index = mh.first_image_index + mh.exth.cover_offset
|
cover_index = mh.first_image_index + mh.exth.cover_offset
|
||||||
data = mh.section_data(int(cover_index))
|
data = mh.section_data(int(cover_index))
|
||||||
else:
|
else:
|
||||||
data = mh.section_data(mh.first_image_index)
|
try:
|
||||||
|
data = mh.section_data(mh.first_image_index)
|
||||||
|
except:
|
||||||
|
data = ''
|
||||||
buf = cStringIO.StringIO(data)
|
buf = cStringIO.StringIO(data)
|
||||||
try:
|
try:
|
||||||
im = PILImage.open(buf)
|
im = PILImage.open(buf)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user