Commit caeafff4 authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

fix erros reported on gitlab

parent 9e5edcb6
......@@ -47,6 +47,7 @@ def request(query, params):
try:
lang, region = params['language'].split('-')
except:
lang = 'en'
region = 'us'
if not params['engine_data'].get('next_page_token'):
params['url'] = search_url.format(query=quote_plus(query), page=params['pageno'], region=region, lang=lang)
......
......@@ -368,6 +368,9 @@ def proxify(url):
def image_proxify(url):
if not isinstance(url, str):
return None
if url.startswith('//'):
url = 'https:' + url
......@@ -1008,6 +1011,8 @@ def image_proxy():
max_redirects=20)
resp = next(stream)
if resp is None:
return '', 400
content_length = resp.headers.get('Content-Length')
if content_length and content_length.isdigit() and int(content_length) > maximum_size:
return 'Max size', 400
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment