on master help sign in
Merge branch 'master' into blog-dev-in-lxc
commitc9795ad01f62babd282074d1d6e836b3e66ad564 authorMarkus Heiser <markus.heiser@darmarIT.de> dateWed 24 Jun 2020, 17:13 (6 years ago) parent9c71f62ccb1fe1
1 file changed+9−2
searx/webapp.py+9−2
searx/webapp.py+9−2
@@ -335,8 +335,15 @@ def image_proxify(url):
335335 if not request.preferences.get_value('image_proxy'):
336336 return url
337337
338− if url.startswith('data:image/jpeg;base64,'):
339− return url
338+ if url.startswith('data:image/'):
339+ # 50 is an arbitrary number to get only the beginning of the image.
340+ partial_base64 = url[len('data:image/'):50].split(';')
341+ if len(partial_base64) == 2 \
342+ and partial_base64[0] in ['gif', 'png', 'jpeg', 'pjpeg', 'webp', 'tiff', 'bmp']\
343+ and partial_base64[1].startswith('base64,'):
344+ return url
345+ else:
346+ return None
340347
341348 if settings.get('result_proxy'):
342349 return proxify(url)