on master help sign in
[fix] content escaping - closes #441

TODO check other engines too

commit0ad272c5cb81a9c69008aa86a1f29cd642ddf4ff authorAdam Tauber <adam.tauber@balabit.com> dateWed 30 Sep 2015, 16:42 (11 years ago) parent8adc801
1 file changed+3−2
searx/engines/google.py+3−2
searx/engines/google.py+3−2
@@ -9,6 +9,7 @@
99# @parse url, title, content, suggestion
1010
1111import re
12+from cgi import escape
1213from urllib import urlencode
1314from urlparse import urlparse, parse_qsl
1415from lxml import html
@@ -167,7 +168,7 @@ def parse_url(url_string, google_hostname):
167168def extract_text_from_dom(result, xpath):
168169 r = result.xpath(xpath)
169170 if len(r) > 0:
170− return extract_text(r[0])
171+ return escape(extract_text(r[0]))
171172 return None
172173
173174
@@ -273,7 +274,7 @@ def response(resp):
273274 # parse suggestion
274275 for suggestion in dom.xpath(suggestion_xpath):
275276 # append suggestion
276− results.append({'suggestion': extract_text(suggestion)})
277+ results.append({'suggestion': escape(extract_text(suggestion))})
277278
278279 # return results
279280 return results