diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-30 00:06:35 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2020-03-30 00:06:35 +0200 |
commit | 8872554949f0d1cb3bf0c544eb3836ac1fda944e (patch) | |
tree | 325eca32f7aadac78f725126f547fa5ecee33388 | |
parent | improvements to the crawler (diff) | |
download | newspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.tar.gz newspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.tar.bz2 newspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.zip |
return transparent image if no favicon are found
-rw-r--r-- | newspipe/web/views/icon.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/newspipe/web/views/icon.py b/newspipe/web/views/icon.py index bbb98ea5..62c39c3e 100644 --- a/newspipe/web/views/icon.py +++ b/newspipe/web/views/icon.py @@ -11,6 +11,10 @@ icon_bp = Blueprint("icon", __name__, url_prefix="/icon") @icon_bp.route("/", methods=["GET"]) @etag_match def icon(): - icon = IconController().get(url=request.args["url"]) - headers = {"Cache-Control": "max-age=86400", "Content-Type": icon.mimetype} - return Response(base64.b64decode(icon.content), headers=headers) + try: + icon = IconController().get(url=request.args["url"]) + headers = {"Cache-Control": "max-age=86400", "Content-Type": icon.mimetype} + return Response(base64.b64decode(icon.content), headers=headers) + except: + headers = {"Cache-Control": "max-age=86400", "Content-Type": "image/gif"} + return Response(base64.b64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="), headers=headers) |