summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 10:18:32 +0100
committerThomas Pointhuber <thomas.pointhuber@gmx.at>2015-02-01 10:18:32 +0100
commit14079ea2b0ac55273171bc9c2120c883d58d4d2f (patch)
tree83c42c8009a726b614d66c04e7167008ee6e9a82 /searx
parent38302ef58ba1224bf89a6667c8df0802071ea9bd (diff)
downloadsearxng-14079ea2b0ac55273171bc9c2120c883d58d4d2f.tar.gz
searxng-14079ea2b0ac55273171bc9c2120c883d58d4d2f.zip
[fix] codec can't encode character inside image_proxify
Diffstat (limited to 'searx')
-rw-r--r--searx/webapp.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index c4eb7d738..d92302b69 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -215,10 +215,12 @@ def image_proxify(url):
if url.startswith('//'):
url = 'https:' + url
+ url = url.encode('utf-8')
+
if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
return url
- h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
+ h = hashlib.sha256(url + settings['server']['secret_key'].encode('utf-8')).hexdigest()
return '{0}?{1}'.format(url_for('image_proxy'),
urlencode(dict(url=url, h=h)))
@@ -553,12 +555,12 @@ def preferences():
@app.route('/image_proxy', methods=['GET'])
def image_proxy():
- url = request.args.get('url')
+ url = request.args.get('url').encode('utf-8')
if not url:
return '', 400
- h = hashlib.sha256(url.encode('utf-8') + settings['server']['secret_key'].encode('utf-8')).hexdigest()
+ h = hashlib.sha256(url + settings['server']['secret_key'].encode('utf-8')).hexdigest()
if h != request.args.get('h'):
return '', 400