瀏覽代碼

[fix] opensearch image issue - closes #507

Adam Tauber 9 年之前
父節點
當前提交
bc81eda64b

+ 1
- 1
searx/templates/courgette/opensearch.xml 查看文件

@@ -3,7 +3,7 @@
3 3
   <ShortName>{{ instance_name }}</ShortName>
4 4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5 5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7 7
   <LongName>searx metasearch</LongName>
8 8
   {% if opensearch_method == 'get' %}
9 9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

+ 1
- 1
searx/templates/default/opensearch.xml 查看文件

@@ -3,7 +3,7 @@
3 3
   <ShortName>{{ instance_name }}</ShortName>
4 4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5 5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7 7
   <LongName>searx metasearch</LongName>
8 8
   {% if opensearch_method == 'get' %}
9 9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

+ 1
- 1
searx/templates/oscar/opensearch.xml 查看文件

@@ -3,7 +3,7 @@
3 3
   <ShortName>{{ instance_name }}</ShortName>
4 4
   <Description>a privacy-respecting, hackable metasearch engine</Description>
5 5
   <InputEncoding>UTF-8</InputEncoding>
6
-  <Image>{{ host }}{{ url_for('static', filename='img/favicon.png') | replace("/", "", 1) }}</Image>
6
+  <Image>{{ urljoin(host, url_for('static', filename='img/favicon.png')) }}</Image>
7 7
   <LongName>searx metasearch</LongName>
8 8
   {% if opensearch_method == 'get' %}
9 9
     <Url type="text/html" method="get" template="{{ host }}search?q={searchTerms}"/>

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

@@ -749,7 +749,8 @@ def opensearch():
749 749
 
750 750
     ret = render('opensearch.xml',
751 751
                  opensearch_method=method,
752
-                 host=get_base_url())
752
+                 host=get_base_url(),
753
+                 urljoin=urljoin)
753 754
 
754 755
     resp = Response(response=ret,
755 756
                     status=200,