on master help sign in
[fix] hash error if url is including non ascii characters
commit38302ef58ba1224bf89a6667c8df0802071ea9bd authorThomas Pointhuber <thomas.pointhuber@gmx.at> dateSun 1 Feb 2015, 10:07 (12 years ago) parent78828ef
1 file changed+2−2
searx/webapp.py+2−2
searx/webapp.py+2−2
@@ -218,7 +218,7 @@ def image_proxify(url):
218218 if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
219219 return url
220220
221− h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
221+ h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
222222
223223 return '{0}?{1}'.format(url_for('image_proxy'),
224224 urlencode(dict(url=url, h=h)))
@@ -558,7 +558,7 @@ def image_proxy():
558558 if not url:
559559 return '', 400
560560
561− h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
561+ h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
562562
563563 if h != request.args.get('h'):
564564 return '', 400