From ebf4068ebc7e9c1efb046814bc60e7a954d5bdd4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Mar 2013 22:51:07 +0530 Subject: [PATCH] Book polishing: Do not error out when updating covers in EPUB files that have entries int heir manifest that point to missing files --- src/calibre/ebooks/oeb/polish/container.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index cf499990a5..a793b58a04 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -94,7 +94,9 @@ class Container(object): # Update mime map with data from the OPF for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'): href = item.get('href') - self.mime_map[self.href_to_name(href, self.opf_name)] = item.get('media-type') + name = self.href_to_name(href, self.opf_name) + if name in self.mime_map: + self.mime_map[name] = item.get('media-type') def abspath_to_name(self, fullpath): return self.relpath(os.path.abspath(fullpath)).replace(os.sep, '/')