diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index 185e408a80..604c4c3c37 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -138,6 +138,9 @@ class Container(object): # {{{ raise InvalidBook('Could not locate opf file: %r'%opfpath) # Update mime map with data from the OPF + self.refresh_mime_map() + + def refresh_mime_map(self): for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'): href = item.get('href') name = self.href_to_name(href, self.opf_name) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index e9f2faa8dc..506eaa9599 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -715,8 +715,12 @@ class Boss(QObject): ed = editors[name] with container.open(name, 'wb') as f: f.write(ed.data) - if container is current_container(): - ed.is_synced_to_container = True + if name == container.opf_name: + container.refresh_mime_map() + if container is current_container(): + ed.is_synced_to_container = True + if name == container.opf_name: + self.gui.file_list.build(container) def commit_all_editors_to_container(self): with BusyCursor():