Don't traceback when favicon.ico is requested, display a nice error instead

This commit is contained in:
southerntofu 2021-07-28 19:43:33 -04:00 committed by metalune
parent 03ddeb2608
commit d51a5089f5
2 changed files with 15 additions and 0 deletions

View file

@ -149,6 +149,13 @@ async def simpleer_search(query, page):
@app.route("/<string:domain>/")
async def instance(domain):
# favicon.ico is not a domain name
if domain == "favicon.ico":
return await render_template(
"error.html",
error_number = "404",
error_reason = "We don't have a favicon yet. If you would like to contribute one, please send it to ~metalune/public-inbox@lists.sr.ht"
), 404
return redirect("/" + domain + "/videos/trending")
@app.route("/<string:domain>/videos/local", defaults = {"page": 1})

8
templates/error.html Normal file
View file

@ -0,0 +1,8 @@
{% extends "base.html" %}
{% block title %}ERROR: {% endblock %}
{% block content %}
<h1>Error {{ error_number }}</h1>
<p>{{ error_reason }}</p>
{% endblock %}