瀏覽代碼

[fix] unicode url proxiing

Adam Tauber 8 年之前
父節點
當前提交
d5c0dcd18a
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. 2
    2
      searx/webapp.py

+ 2
- 2
searx/webapp.py 查看文件

@@ -250,7 +250,7 @@ def proxify(url):
250 250
     if not settings.get('result_proxy'):
251 251
         return url
252 252
 
253
-    h = hmac.new(settings['result_proxy']['key'], url, hashlib.sha256).hexdigest()
253
+    h = hmac.new(settings['result_proxy']['key'], url.encode('utf-8'), hashlib.sha256).hexdigest()
254 254
 
255 255
     return '{0}?{1}'.format(settings['result_proxy']['url'],
256 256
                             urlencode(dict(mortyurl=url.encode('utf-8'),
@@ -265,7 +265,7 @@ def image_proxify(url):
265 265
     if not request.preferences.get_value('image_proxy'):
266 266
         return url
267 267
 
268
-    h = hmac.new(settings['server']['secret_key'], url, hashlib.sha256).hexdigest()
268
+    h = hmac.new(settings['server']['secret_key'], url.encode('utf-8'), hashlib.sha256).hexdigest()
269 269
 
270 270
     return '{0}?{1}'.format(url_for('image_proxy'),
271 271
                             urlencode(dict(url=url.encode('utf-8'), h=h)))