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)

This commit is contained in:
Kovid Goyal 2019-10-15 06:21:28 +05:30
parent 0bf8898ca4
commit f38a7d15ba
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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)