From 8824104847b17328e67a6e369592ca29658131c2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Aug 2011 16:06:48 -0600 Subject: [PATCH] ... --- src/calibre/ebooks/mobi/writer2/serializer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/mobi/writer2/serializer.py b/src/calibre/ebooks/mobi/writer2/serializer.py index 377b29655c..9bbaa436a7 100644 --- a/src/calibre/ebooks/mobi/writer2/serializer.py +++ b/src/calibre/ebooks/mobi/writer2/serializer.py @@ -116,6 +116,12 @@ class Serializer(object): buf.write(b'') self.end_offset = buf.tell() self.fixup_links() + if self.start_offset is None: + # If we don't set a start offset, the stupid Kindle will + # open the book at the location of the first IndexEntry, which + # could be anywhere. So ensure the book is always opened at the + # beginning, instead. + self.start_offset = self.body_start_offset return buf.getvalue() def serialize_head(self):