Browse Source

[fix] hash error if url is including non ascii characters

Thomas Pointhuber 10 years ago
parent
commit
38302ef58b
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      searx/webapp.py

+ 2
- 2
searx/webapp.py View File

@@ -218,7 +218,7 @@ def image_proxify(url):
218 218
     if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
219 219
         return url
220 220
 
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()
222 222
 
223 223
     return '{0}?{1}'.format(url_for('image_proxy'),
224 224
                             urlencode(dict(url=url, h=h)))
@@ -558,7 +558,7 @@ def image_proxy():
558 558
     if not url:
559 559
         return '', 400
560 560
 
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()
562 562
 
563 563
     if h != request.args.get('h'):
564 564
         return '', 400