From f38a7d15ba7561b16e3596792ba4c70bb11f7e3c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Oct 2019 06:21:28 +0530 Subject: [PATCH] EPUB 2 metadata: Fix obfuscated fonts being broken when updating metadata if the file uses Adobe font obfuscation and the identifier with the key has an uppercase UUID scheme name. Fixes #1847890 [dc:identifier line being removed from content.opf](https://bugs.launchpad.net/calibre/+bug/1847890) --- src/calibre/ebooks/metadata/opf2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/metadata/opf2.py b/src/calibre/ebooks/metadata/opf2.py index c57fe7c758..f8df51bed4 100644 --- a/src/calibre/ebooks/metadata/opf2.py +++ b/src/calibre/ebooks/metadata/opf2.py @@ -994,11 +994,11 @@ class OPF(object): # {{{ self.metadata): xid = x.get('id', None) is_package_identifier = uuid_id is not None and uuid_id == xid - typ = {val for attr, val in iteritems(x.attrib) if attr.endswith('scheme')} + typ = {val.lower() for attr, val in iteritems(x.attrib) if attr.endswith('scheme')} if is_package_identifier: typ = tuple(typ) - if typ and typ[0].lower() in identifiers: - self.set_text(x, identifiers.pop(typ[0].lower())) + if typ and typ[0] in identifiers: + self.set_text(x, identifiers.pop(typ[0])) continue if typ and not (typ & {'calibre', 'uuid'}): x.getparent().remove(x)