From 93961cb8ab025dd55850b750050c653bca00610d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Apr 2022 14:40:18 +0530 Subject: [PATCH] Fix #1970171 [Failed to open book](https://bugs.launchpad.net/calibre/+bug/1970171) --- src/calibre/ebooks/oeb/polish/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/container.py b/src/calibre/ebooks/oeb/polish/container.py index aa37c9821c..20d4996ee4 100644 --- a/src/calibre/ebooks/oeb/polish/container.py +++ b/src/calibre/ebooks/oeb/polish/container.py @@ -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