Skip to content

Commit d645a31

Browse files
authored
feat: serve 404 page locally (#160)
Resolves #159 Signed-off-by: Mike Fiedler <[email protected]>
1 parent 5756f29 commit d645a31

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

inspector/main.py

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def versions(project_name):
6464
resp = requests.get(f"https://pypi.org/pypi/{project_name}/json")
6565
pypi_project_url = f"https://pypi.org/project/{project_name}"
6666

67+
# Self-host 404 page to mitigate iframe embeds
68+
if resp.status_code == 404:
69+
return render_template("404.html")
6770
if resp.status_code != 200:
6871
return redirect(pypi_project_url, 307)
6972

inspector/templates/404.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% extends 'base.html' %}
2+
3+
{% block body %}
4+
<h1>NOT FOUND</h1>
5+
{% endblock %}

0 commit comments

Comments
 (0)