From 89c0ad4cca6298aa722cbc84af66832a1f37f205 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 8 Aug 2012 18:42:35 +0530 Subject: [PATCH] EPUB: Handle files in the EPUB that have semi-colons in their file names. This means in particular using URL escaping when creating the NCX as ADE cannot handle unescaped semi-colons in the NCX. See #1033665 --- src/calibre/ebooks/metadata/toc.py | 4 ++-- src/calibre/ebooks/oeb/base.py | 2 +- src/calibre/gui2/viewer/main.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/metadata/toc.py b/src/calibre/ebooks/metadata/toc.py index a95ff9f44c..0f22603a8b 100644 --- a/src/calibre/ebooks/metadata/toc.py +++ b/src/calibre/ebooks/metadata/toc.py @@ -196,8 +196,8 @@ class TOC(list): content = content[0] src = get_attr(content, attr='src') if src: - purl = urlparse(unquote(content.get('src'))) - href, fragment = purl[2], purl[5] + purl = urlparse(content.get('src')) + href, fragment = unquote(purl[2]), unquote(purl[5]) nd = dest.add_item(href, fragment, text) nd.play_order = play_order diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 3470f601d0..07de23d866 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -1541,7 +1541,7 @@ class TOC(object): if title: title = re.sub(r'\s+', ' ', title) element(label, NCX('text')).text = title - element(point, NCX('content'), src=urlunquote(node.href)) + element(point, NCX('content'), src=node.href) node.to_ncx(point) return parent diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 791fda0f93..49487518ef 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -577,7 +577,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer): if not os.path.exists(item.abspath): return error_dialog(self, _('No such location'), _('The location pointed to by this item' - ' does not exist.'), show=True) + ' does not exist.'), det_msg=item.abspath, show=True) url = QUrl.fromLocalFile(item.abspath) if item.fragment: url.setFragment(item.fragment)