diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2020-06-25 05:42:28 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-25 05:42:28 +0000 |
| commit | fc370faa5bf2d11031a389c39f8a49d85f2f164c (patch) | |
| tree | 214719b6d95a34c67431210aaa9b0c4fd4ee7e43 /searx/webapp.py | |
| parent | 4eab5cf854cdadea07f34d22a801c05e73730c5c (diff) | |
| parent | ccb1fe11d7d728ab00d32f7626f8f8321befe2ea (diff) | |
Merge branch 'master' into gigablast
Diffstat (limited to 'searx/webapp.py')
| -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) |