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

This commit is contained in:
Kovid Goyal 2012-08-08 18:42:35 +05:30
parent aab1e91f50
commit 89c0ad4cca
3 changed files with 4 additions and 4 deletions

View File

@ -196,8 +196,8 @@ class TOC(list):
content = content[0] content = content[0]
src = get_attr(content, attr='src') src = get_attr(content, attr='src')
if src: if src:
purl = urlparse(unquote(content.get('src'))) purl = urlparse(content.get('src'))
href, fragment = purl[2], purl[5] href, fragment = unquote(purl[2]), unquote(purl[5])
nd = dest.add_item(href, fragment, text) nd = dest.add_item(href, fragment, text)
nd.play_order = play_order nd.play_order = play_order

View File

@ -1541,7 +1541,7 @@ class TOC(object):
if title: if title:
title = re.sub(r'\s+', ' ', title) title = re.sub(r'\s+', ' ', title)
element(label, NCX('text')).text = 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) node.to_ncx(point)
return parent return parent

View File

@ -577,7 +577,7 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
if not os.path.exists(item.abspath): if not os.path.exists(item.abspath):
return error_dialog(self, _('No such location'), return error_dialog(self, _('No such location'),
_('The location pointed to by this item' _('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) url = QUrl.fromLocalFile(item.abspath)
if item.fragment: if item.fragment:
url.setFragment(item.fragment) url.setFragment(item.fragment)