1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +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:
Ilya Kreymer 2015-02-10 15:05:15 -08:00
parent 90aba00ca0
commit 4e7f95081f

View File

@ -75,7 +75,10 @@ class UrlRewriter(object):
url=new_url,
iri=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