From 66a6f90b1d533ac149e76d8938c778b9dd4c8c44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Jan 2018 23:31:16 +0530 Subject: [PATCH] Edit Book: Fix incorrect EPUB 3 declarations being added to the OPF file when adding covers to an EPUB 2 book --- src/calibre/ebooks/oeb/polish/cover.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/oeb/polish/cover.py b/src/calibre/ebooks/oeb/polish/cover.py index 6b5a6321f0..e30a2fc347 100644 --- a/src/calibre/ebooks/oeb/polish/cover.py +++ b/src/calibre/ebooks/oeb/polish/cover.py @@ -302,9 +302,11 @@ def clean_opf(container): name = gtm.get(typ, None) if name and name in container.name_path_map: yield name - removed_names = container.apply_unique_properties(None, 'cover-image', 'calibre:title-page')[0] - for name in removed_names: - yield name + ver = container.opf_version_parsed + if ver.major > 2: + removed_names = container.apply_unique_properties(None, 'cover-image', 'calibre:title-page')[0] + for name in removed_names: + yield name container.dirty(container.opf_name)