mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 11:34:48 +01:00
Convert bytes urls to strings when canonicalizing internal urls
This commit is contained in:
parent
78822589d8
commit
9a6d284cf4
1 changed files with 7 additions and 1 deletions
|
|
@ -681,7 +681,13 @@ def canonicalize_internal_url(self, url, is_link=True):
|
|||
except Exception:
|
||||
self.log.error('Failed to parse url: %r, ignoring' % url)
|
||||
return frozenset()
|
||||
return frozenset([(parts.netloc, (parts.path or '').rstrip('/'))])
|
||||
nl = parts.netloc
|
||||
path = parts.path or ''
|
||||
if isinstance(nl, bytes):
|
||||
nl = nl.decode('utf-8', 'replace')
|
||||
if isinstance(path, bytes):
|
||||
path = path.decode('utf-8', 'replace')
|
||||
return frozenset({(nl, path.rstrip('/'))})
|
||||
|
||||
def index_to_soup(self, url_or_raw, raw=False, as_tree=False, save_raw=None):
|
||||
'''
|
||||
|
|
|
|||
Loading…
Reference in a new issue