mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
74bcc915d4
@ -37,8 +37,13 @@ class EPUBInput(InputFormatPlugin):
|
|||||||
scheme = item.get(xkey)
|
scheme = item.get(xkey)
|
||||||
if (scheme and scheme.lower() == 'uuid') or \
|
if (scheme and scheme.lower() == 'uuid') or \
|
||||||
(item.text and item.text.startswith('urn:uuid:')):
|
(item.text and item.text.startswith('urn:uuid:')):
|
||||||
key = str(item.text).rpartition(':')[-1]
|
try:
|
||||||
key = list(map(ord, uuid.UUID(key).bytes))
|
key = str(item.text).rpartition(':')[-1]
|
||||||
|
key = list(map(ord, uuid.UUID(key).bytes))
|
||||||
|
except:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
key = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
root = etree.parse(encfile)
|
root = etree.parse(encfile)
|
||||||
@ -49,7 +54,7 @@ class EPUBInput(InputFormatPlugin):
|
|||||||
cr = em.getparent().xpath('descendant::*[contains(name(), "CipherReference")]')[0]
|
cr = em.getparent().xpath('descendant::*[contains(name(), "CipherReference")]')[0]
|
||||||
uri = cr.get('URI')
|
uri = cr.get('URI')
|
||||||
path = os.path.abspath(os.path.join(os.path.dirname(encfile), '..', *uri.split('/')))
|
path = os.path.abspath(os.path.join(os.path.dirname(encfile), '..', *uri.split('/')))
|
||||||
if os.path.exists(path):
|
if key is not None and os.path.exists(path):
|
||||||
self._encrypted_font_uris.append(uri)
|
self._encrypted_font_uris.append(uri)
|
||||||
self.decrypt_font(key, path)
|
self.decrypt_font(key, path)
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user