mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -560,7 +560,9 @@ class OPF(object): # {{{
|
||||
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…
x
Reference in New Issue
Block a user