diff options
| author | Noémi Ványi <kvch@users.noreply.github.com> | 2020-06-28 20:28:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-28 20:28:12 +0200 |
| commit | 93cbd85b8a5becdf69e6d70dd7c60f7122531262 (patch) | |
| tree | 90d202af89e02fc3e83d5bdf4a924b05ff197261 /searx/webapp.py | |
| parent | 385e9b5c9e2d1caa73f99dac0bf1be1c46505121 (diff) | |
| parent | f9f5974968ce767c24eea8c8a651d0e3945fc01b (diff) | |
Merge branch 'master' into duckduckgo_correction
Diffstat (limited to 'searx/webapp.py')
| -rwxr-xr-x | searx/webapp.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 2ba8ccfb8..e1b6bea1c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -335,8 +335,15 @@ def image_proxify(url): if not request.preferences.get_value('image_proxy'): return url - if url.startswith('data:image/jpeg;base64,'): - return url + if url.startswith('data:image/'): + # 50 is an arbitrary number to get only the beginning of the image. + partial_base64 = url[len('data:image/'):50].split(';') + if len(partial_base64) == 2 \ + and partial_base64[0] in ['gif', 'png', 'jpeg', 'pjpeg', 'webp', 'tiff', 'bmp']\ + and partial_base64[1].startswith('base64,'): + return url + else: + return None if settings.get('result_proxy'): return proxify(url) @@ -949,7 +956,7 @@ def opensearch(): resp = Response(response=ret, status=200, - mimetype="text/xml") + mimetype="application/opensearchdescription+xml") return resp @@ -1021,6 +1028,14 @@ def config(): }) +@app.route('/translations.js') +def js_translations(): + return render( + 'translations.js.tpl', + override_theme='__common__', + ), {'Content-Type': 'text/javascript; charset=UTF-8'} + + @app.errorhandler(404) def page_not_found(e): return render('404.html'), 404 |