Parcourir la source

[fix] image proxify utf urls

Adam Tauber il y a 10 ans
Parent
révision
c711212662
1 fichiers modifiés avec 3 ajouts et 4 suppressions
  1. 3
    4
      searx/webapp.py

+ 3
- 4
searx/webapp.py Voir le fichier

@@ -215,15 +215,14 @@ def image_proxify(url):
215 215
     if url.startswith('//'):
216 216
         url = 'https:' + url
217 217
 
218
-    url = url.encode('utf-8')
219
-
220 218
     if not settings['server'].get('image_proxy') and not request.cookies.get('image_proxy'):
221 219
         return url
222 220
 
223
-    h = hashlib.sha256(url + settings['server']['secret_key'].encode('utf-8')).hexdigest()
221
+    hash_string = url + settings['server']['secret_key']
222
+    h = hashlib.sha256(hash_string.encode('utf-8')).hexdigest()
224 223
 
225 224
     return '{0}?{1}'.format(url_for('image_proxy'),
226
-                            urlencode(dict(url=url, h=h)))
225
+                            urlencode(dict(url=url.encode('utf-8'), h=h)))
227 226
 
228 227
 
229 228
 def render(template_name, override_theme=None, **kwargs):