mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
url_rewriter: catch exception when encoding to utf-8, may not be properly encoded, in which
case treat as bytes
This commit is contained in:
parent
90aba00ca0
commit
4e7f95081f
@ -75,7 +75,10 @@ class UrlRewriter(object):
|
|||||||
url=new_url,
|
url=new_url,
|
||||||
iri=not ascii_urls_only)
|
iri=not ascii_urls_only)
|
||||||
if not ascii_urls_only:
|
if not ascii_urls_only:
|
||||||
final_url = final_url.encode('utf-8')
|
try:
|
||||||
|
final_url = final_url.encode('utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
return final_url
|
return final_url
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user