Edit Book: Fix Check Book reporting a spurious mime/type mismatch error after replacing a file with a file having a different mime type. Fixes #1653977 [Editor:Problem with Check Book after using Replace image with file](https://bugs.launchpad.net/calibre/+bug/1653977)

This commit is contained in:
Kovid Goyal 2017-01-05 10:14:19 +05:30
parent 257ef9ad9b
commit c606844677

View File

@ -219,6 +219,7 @@ def replace_file(container, name, path, basename, force_mt=None):
nname = b + ('_%d.%s' % (count, e)) nname = b + ('_%d.%s' % (count, e))
rename_files(container, {name:nname}) rename_files(container, {name:nname})
mt = force_mt or container.guess_type(nname) mt = force_mt or container.guess_type(nname)
container.mime_map[nname] = mt
for itemid, q in container.manifest_id_map.iteritems(): for itemid, q in container.manifest_id_map.iteritems():
if q == nname: if q == nname:
for item in container.opf_xpath('//opf:manifest/opf:item[@href and @id="%s"]' % itemid): for item in container.opf_xpath('//opf:manifest/opf:item[@href and @id="%s"]' % itemid):