diff --git a/inspector/main.py b/inspector/main.py index 3c25b6a..13f73a7 100755 --- a/inspector/main.py +++ b/inspector/main.py @@ -64,6 +64,9 @@ def versions(project_name): resp = requests.get(f"https://pypi.org/pypi/{project_name}/json") pypi_project_url = f"https://pypi.org/project/{project_name}" + # Self-host 404 page to mitigate iframe embeds + if resp.status_code == 404: + return render_template("404.html") if resp.status_code != 200: return redirect(pypi_project_url, 307) diff --git a/inspector/templates/404.html b/inspector/templates/404.html new file mode 100644 index 0000000..caa47e9 --- /dev/null +++ b/inspector/templates/404.html @@ -0,0 +1,5 @@ +{% extends 'base.html' %} + +{% block body %} +

NOT FOUND

+{% endblock %}