This commit is contained in:
Kovid Goyal 2022-04-25 14:40:18 +05:30
parent 78e6966dae
commit 93961cb8ab
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -302,7 +302,10 @@ class Container(ContainerBase): # {{{
def refresh_mime_map(self):
for item in self.opf_xpath('//opf:manifest/opf:item[@href and @media-type]'):
href = item.get('href')
name = self.href_to_name(href, self.opf_name)
try:
name = self.href_to_name(href, self.opf_name)
except ValueError:
continue # special filenames such as CON on windows cause relpath to fail
mt = item.get('media-type')
if name in self.mime_map and name != self.opf_name and mt:
# some epubs include the opf in the manifest with an incorrect mime type