瀏覽代碼

[fix] description escaping

asciimoo 11 年之前
父節點
當前提交
9bd4459638
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      searx/engines/github.py

+ 2
- 1
searx/engines/github.py 查看文件

1
 from urllib import urlencode
1
 from urllib import urlencode
2
 from json import loads
2
 from json import loads
3
+from cgi import escape
3
 
4
 
4
 categories = ['it']
5
 categories = ['it']
5
 
6
 
20
     for res in search_res['items']:
21
     for res in search_res['items']:
21
         title = res['name']
22
         title = res['name']
22
         url = res['html_url']
23
         url = res['html_url']
23
-        content = res['description']
24
+        content = escape(res['description'][:500])
24
         results.append({'url': url, 'title': title, 'content': content})
25
         results.append({'url': url, 'title': title, 'content': content})
25
     return results
26
     return results