summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2020-06-30 15:37:39 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2020-06-30 15:37:39 +0200
commitf14a7add31c8db54c90ee7bd8504e3f395faf944 (patch)
tree42690fa0e0b77f81f87201635e4d3f73c4330739 /searx/webapp.py
parentca1c3bd15d60faf235894cb4f6f3a15150e3a6c3 (diff)
parentc59ca600423367d54e9b301cf086deeb66602831 (diff)
Merge branch 'master' of https://github.com/asciimoo/searx into csp-oscar-theme
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 35495a0ff..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)