summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 10:07:53 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 10:07:53 +0100
commit38302ef58ba1224bf89a6667c8df0802071ea9bd (patch)
tree60a94439489d2a7d5a49e796410bc68526b2d7fd /searx/webapp.py
parent78828efdb0ea28efa057dbd82b240af1112f085a (diff)
downloadsearxng-38302ef58ba1224bf89a6667c8df0802071ea9bd.tar.gz
searxng-38302ef58ba1224bf89a6667c8df0802071ea9bd.zip
[fix] hash error if url is including non ascii characters
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index d612af410..c4eb7d738 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -218,7 +218,7 @@ def image_proxify(url):
if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
return url
- h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
+ h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
return '{0}?{1}'.format(url_for('image_proxy'),
urlencode(dict(url=url, h=h)))
@@ -558,7 +558,7 @@ def image_proxy():
if not url:
return '', 400
- h = hashlib.sha256(url + settings['server']['secret_key']).hexdigest()
+ h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
if h != request.args.get('h'):
return '', 400