From fc2fab8a53220faab4da222ae0af9da78b09aba0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 Mar 2015 07:59:16 +0530 Subject: [PATCH] PDF Output: Ignore unparseable links instead of aborting the conversion on them. Fixes #1429282 [HTML to PDF crashes with ebook-convert (Invalid IPv6 URL)](https://bugs.launchpad.net/calibre/+bug/1429282) --- src/calibre/ebooks/pdf/render/links.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/pdf/render/links.py b/src/calibre/ebooks/pdf/render/links.py index 42eec636a0..902dd74b4a 100644 --- a/src/calibre/ebooks/pdf/render/links.py +++ b/src/calibre/ebooks/pdf/render/links.py @@ -78,7 +78,11 @@ class Links(object): pass else: url = href + (('#'+frag) if frag else '') - purl = urlparse(url) + try: + purl = urlparse(url) + except Exception: + self.pdf.debug('Ignoring unparseable URL: %r' % url) + continue if purl.scheme and purl.scheme != 'file': action = Dictionary({ 'Type':Name('Action'), 'S':Name('URI'),