mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 10:43:52 +02:00
EPUB Input: Handle EPUB files that have no <metadata> section in their OPF. See #1181546
This commit is contained in:
parent
d36fe89352
commit
474af52890
1 changed files with 3 additions and 1 deletions
|
|
@ -560,7 +560,9 @@ def __init__(self, stream, basedir=os.getcwdu(), unquote_urls=True,
|
|||
self.package_version = 0
|
||||
self.metadata = self.metadata_path(self.root)
|
||||
if not self.metadata:
|
||||
raise ValueError('Malformed OPF file: No <metadata> element')
|
||||
self.metadata = [self.root.makeelement('{http://www.idpf.org/2007/opf}metadata')]
|
||||
self.root.insert(0, self.metadata[0])
|
||||
self.metadata[0].tail = '\n'
|
||||
self.metadata = self.metadata[0]
|
||||
if unquote_urls:
|
||||
self.unquote_urls()
|
||||
|
|
|
|||
Loading…
Reference in a new issue