Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b2436d2 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Fix no proxy for b64 images

parent 13b37068
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -22,6 +22,16 @@ def proxify(url):
    if not settings.get('result_proxy'):
    if not settings.get('result_proxy'):
        return url
        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

    url_params = dict(mortyurl=url.encode('utf-8'))
    url_params = dict(mortyurl=url.encode('utf-8'))


    if settings['result_proxy'].get('key'):
    if settings['result_proxy'].get('key'):