on master help sign in
[fix] proper escaping of the search query in templates
commit28f12ef5a0917b8cefddb4d5f74c9aaeb945355f authorAdam Tauber <asciimoo@gmail.com> dateSun 4 Dec 2016, 23:07 (10 years ago) parent7986d4c
4 files changed+20−20
searx/templates/courgette/results.html+5−5 searx/templates/legacy/results.html+5−5 searx/templates/oscar/results.html+7−7 searx/templates/pix-art/results.html+3−3
searx/templates/courgette/results.html+5−5
@@ -1,6 +1,6 @@
11{% extends "courgette/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
44{% block content %}
55<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>{{ _('preferences') }}</span></a></div>
66<div class="small search center">
@@ -17,7 +17,7 @@
1717 {% for output_type in ('csv', 'json', 'rss') %}
1818 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
1919 <div class="left">
20− <input type="hidden" name="q" value="{{ q }}" />
20+ <input type="hidden" name="q" value="{{ q|e }}" />
2121 <input type="hidden" name="format" value="{{ output_type }}" />
2222 {% for category in selected_categories %}
2323 <input type="hidden" name="category_{{ category }}" value="1"/>
@@ -62,7 +62,7 @@
6262 {% if pageno > 1 %}
6363 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
6464 <div class="left">
65− <input type="hidden" name="q" value="{{ q }}" />
65+ <input type="hidden" name="q" value="{{ q|e }}" />
6666 {% for category in selected_categories %}
6767 <input type="hidden" name="category_{{ category }}" value="1"/>
6868 {% endfor %}
@@ -76,7 +76,7 @@
7676 {% for category in selected_categories %}
7777 <input type="hidden" name="category_{{ category }}" value="1"/>
7878 {% endfor %}
79− <input type="hidden" name="q" value="{{ q }}" />
79+ <input type="hidden" name="q" value="{{ q|e }}" />
8080 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
8181 <input type="submit" value="{{ _('next page') }} >>" />
8282 </div>
searx/templates/legacy/results.html+5−5
@@ -1,6 +1,6 @@
11{% extends "legacy/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}">{% endblock %}
44{% block content %}
55<div class="preferences_container right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
66<div class="small search center">
@@ -18,7 +18,7 @@
1818 {% for output_type in ('csv', 'json', 'rss') %}
1919 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
2020 <div class="left">
21− <input type="hidden" name="q" value="{{ q }}" />
21+ <input type="hidden" name="q" value="{{ q|e }}" />
2222 <input type="hidden" name="format" value="{{ output_type }}" />
2323 {% for category in selected_categories %}
2424 <input type="hidden" name="category_{{ category }}" value="1"/>
@@ -73,7 +73,7 @@
7373 {% if pageno > 1 %}
7474 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}">
7575 <div class="{% if rtl %}right{% else %}left{% endif %}">
76− <input type="hidden" name="q" value="{{ q }}" />
76+ <input type="hidden" name="q" value="{{ q|e }}" />
7777 {% for category in selected_categories %}
7878 <input type="hidden" name="category_{{ category }}" value="1"/>
7979 {% endfor %}
@@ -87,7 +87,7 @@
8787 {% for category in selected_categories %}
8888 <input type="hidden" name="category_{{ category }}" value="1"/>
8989 {% endfor %}
90− <input type="hidden" name="q" value="{{ q }}" />
90+ <input type="hidden" name="q" value="{{ q|e }}" />
9191 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
9292 <input type="submit" value="{{ _('next page') }} >>" />
9393 </div>
searx/templates/oscar/results.html+7−7
@@ -1,6 +1,6 @@
11{% extends "oscar/base.html" %}
2−{% block title %}{{ q }} - {% endblock %}
3−{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}&amp;time_range={{ time_range }}">{% endblock %}
2+{% block title %}{{ q|e }} - {% endblock %}
3+{% block meta %}<link rel="alternate" type="application/rss+xml" title="Searx search: {{ q|e }}" href="{{ url_for('index') }}?q={{ q|urlencode }}&amp;format=rss&amp;{% for category in selected_categories %}category_{{ category }}=1&amp;{% endfor %}pageno={{ pageno }}&amp;time_range={{ time_range }}">{% endblock %}
44{% block content %}
55 <div class="row">
66 <div class="col-sm-8" id="main_results">
@@ -37,9 +37,9 @@
3737 <div id="pagination">
3838 <div class="pull-left">
3939 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
40− <input type="hidden" name="q" value="{{ q }}" />
40+ <input type="hidden" name="q" value="{{ q|e }}" />
4141 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
42− <input type="hidden" name="q" value="{{ q }}" />
42+ <input type="hidden" name="q" value="{{ q|e }}" />
4343 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
4444 <input type="hidden" name="time_range" value="{{ time_range }}" />
4545 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button>
@@ -59,7 +59,7 @@
5959 <div id="pagination">
6060 <div class="pull-left">
6161 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
62− <input type="hidden" name="q" value="{{ q }}" />
62+ <input type="hidden" name="q" value="{{ q|e }}" />
6363 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
6464 <input type="hidden" name="pageno" value="{{ pageno-1 }}" />
6565 <input type="hidden" name="time_range" value="{{ time_range }}" />
@@ -69,7 +69,7 @@
6969 <div class="pull-right">
7070 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left">
7171 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %}
72− <input type="hidden" name="q" value="{{ q }}" />
72+ <input type="hidden" name="q" value="{{ q|e }}" />
7373 <input type="hidden" name="pageno" value="{{ pageno+1 }}" />
7474 <input type="hidden" name="time_range" value="{{ time_range }}" />
7575 <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-forward"></span> {{ _('next page') }}</button>
@@ -130,7 +130,7 @@
130130 <div class="clearfix"></div>
131131 {% for output_type in ('csv', 'json', 'rss') %}
132132 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="form-inline pull-{% if rtl %}right{% else %}left{% endif %} result_download">
133− <input type="hidden" name="q" value="{{ q }}">
133+ <input type="hidden" name="q" value="{{ q|e }}">
134134 <input type="hidden" name="format" value="{{ output_type }}">
135135 {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1">{% endfor %}
136136 <input type="hidden" name="pageno" value="{{ pageno }}">
searx/templates/pix-art/results.html+3−3
@@ -5,7 +5,7 @@
55 {% endfor %}
66{% else %}
77{% extends "pix-art/base.html" %}
8−{% block title %}{{ q }} - {% endblock %}
8+{% block title %}{{ q|e }} - {% endblock %}
99{% block meta %}{% endblock %}
1010{% block content %}
1111<div id="logo"><a href="./"><img src="{{ url_for('static', filename='img/searx-pixel-small.png') }}" alt="searx Logo"/></a></div>
@@ -25,8 +25,8 @@
2525 </span>
2626 <div id="pagination">
2727 <br />
28− <input type="button" onclick="load_more('{{ q }}', {{ pageno+1 }})" id="load_more" value="{{ _('Load more...') }}" />
28+ <input type="button" onclick="load_more('{{ q|e }}', {{ pageno+1 }})" id="load_more" value="{{ _('Load more...') }}" />
2929 </div>
3030</div>
3131{% endblock %}
32−{% endif %}
32+{% endif %}