forked from Icycoide/searxng
[fix] searx.network.stream: fix memory leak
This commit is contained in:
parent
2eab89b4ca
commit
29893cf816
3 changed files with 42 additions and 17 deletions
|
@ -85,7 +85,10 @@ def _download_and_check_if_image(image_url: str) -> bool:
|
|||
})
|
||||
r = next(stream)
|
||||
r.close()
|
||||
is_image = r.headers["content-type"].startswith('image/')
|
||||
if r.status_code == 200:
|
||||
is_image = r.headers.get('content-type', '').startswith('image/')
|
||||
else:
|
||||
is_image = False
|
||||
del r
|
||||
del stream
|
||||
return is_image
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue