diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2020-06-24 17:13:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-24 17:13:20 +0000 |
commit | c9795ad01f62babd282074d1d6e836b3e66ad564 (patch) | |
tree | c74ba524bdbda643e717504a6ffb691420724f54 | |
parent | 9c71f620a7c29ea22e4f1743e733bd267cdb4b69 (diff) | |
parent | ccb1fe11d7d728ab00d32f7626f8f8321befe2ea (diff) | |
download | searxng-c9795ad01f62babd282074d1d6e836b3e66ad564.tar.gz searxng-c9795ad01f62babd282074d1d6e836b3e66ad564.zip |
Merge branch 'master' into blog-dev-in-lxc
-rwxr-xr-x | searx/webapp.py | 11 |
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) |