mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
fix exceptions in mobi caused by new thumbnails being larger than the one stored in the file. Why things are done this way, I don't know.
This commit is contained in:
parent
3c5e8c0291
commit
3941b9c4a1
@ -404,11 +404,13 @@ class MetadataUpdater(object):
|
|||||||
if self.cover_record is not None:
|
if self.cover_record is not None:
|
||||||
size = len(self.cover_record)
|
size = len(self.cover_record)
|
||||||
cover = rescale_image(data, size)
|
cover = rescale_image(data, size)
|
||||||
|
if len(cover) <= size:
|
||||||
cover += '\0' * (size - len(cover))
|
cover += '\0' * (size - len(cover))
|
||||||
self.cover_record[:] = cover
|
self.cover_record[:] = cover
|
||||||
if self.thumbnail_record is not None:
|
if self.thumbnail_record is not None:
|
||||||
size = len(self.thumbnail_record)
|
size = len(self.thumbnail_record)
|
||||||
thumbnail = rescale_image(data, size, dimen=MAX_THUMB_DIMEN)
|
thumbnail = rescale_image(data, size, dimen=MAX_THUMB_DIMEN)
|
||||||
|
if len(thumbnail) <= size:
|
||||||
thumbnail += '\0' * (size - len(thumbnail))
|
thumbnail += '\0' * (size - len(thumbnail))
|
||||||
self.thumbnail_record[:] = thumbnail
|
self.thumbnail_record[:] = thumbnail
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user