aboutsummaryrefslogtreecommitdiff
path: root/newspipe
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-30 00:06:35 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2020-03-30 00:06:35 +0200
commit8872554949f0d1cb3bf0c544eb3836ac1fda944e (patch)
tree325eca32f7aadac78f725126f547fa5ecee33388 /newspipe
parentimprovements to the crawler (diff)
downloadnewspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.tar.gz
newspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.tar.bz2
newspipe-8872554949f0d1cb3bf0c544eb3836ac1fda944e.zip
return transparent image if no favicon are found
Diffstat (limited to 'newspipe')
-rw-r--r--newspipe/web/views/icon.py10
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)
bgstack15