Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions server/routes.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from flask import redirect, request, jsonify, abort, send_from_directory
import re

from flask import abort, jsonify, redirect, request, send_from_directory

from . import app, talisman, render_template, url_for
from . import app
from . import faq as faq_util
from . import render_template
from . import reports as report_util
from . import talisman
from . import techreport as tech_report_util
from . import faq as faq_util
from . import url_for


def safe_int(value, default=1):
Expand Down Expand Up @@ -88,6 +91,10 @@ def techreportlanding(page_id):
# Get the settings for the current page
active_tech_report = tech_report.get("pages").get(page_id)

# Check if the page exists
if active_tech_report is None:
abort(404)

# Add the technologies requested in the URL to the filters
# Use the default configured techs as fallback
# Use ["ALL"] if there is nothing configured
Expand Down
28 changes: 27 additions & 1 deletion server/tests/routes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from server import app, talisman
import pytest

from server import app, talisman


# Create test client without https redirect
# (normally taken care of by running in debug)
Expand Down Expand Up @@ -257,6 +258,31 @@ def test_tech_report_category_pages_fallback(client):
assert response.status_code == 200


def test_tech_report_landing_valid_page(client):
response = client.get("/reports/techreport/landing")
assert response.status_code == 200


def test_tech_report_drilldown_page(client):
response = client.get("/reports/techreport/drilldown")
assert response.status_code == 200


def test_tech_report_comparison_page(client):
response = client.get("/reports/techreport/comparison")
assert response.status_code == 200


def test_tech_report_category_page(client):
response = client.get("/reports/techreport/category")
assert response.status_code == 200


def test_tech_report_invalid_page(client):
response = client.get("/reports/techreport/invalid_page_id")
assert response.status_code == 404


def test_well_known_atproto_did(client):
response = client.get("/.well-known/atproto-did")
assert response.status_code == 200
6 changes: 1 addition & 5 deletions templates/error/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
{% block error %}Page Not Found{% endblock %}

{% block custom %}
<p>
We've recently <a href="https://discuss.httparchive.org/t/announcing-the-new-http-archive/1294">launched a new version of the HTTP Archive</a>.
Some URLs may have been updated, please take a look at our new site!
If the information you're looking for is missing, please <a href="https://discuss.httparchive.org/t/announcing-the-new-http-archive/1294">let us know</a>.
</p>
<p>If the information you're looking for is missing, please <a href="https://github.com/HTTPArchive/httparchive.org/issues/new?template=BLANK_ISSUE" target="_blank">let us know</a>.</p>
{% endblock %}
2 changes: 1 addition & 1 deletion tools/scripts/set_lighthouse_urls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ elif [ "${RUN_TYPE}" == "pull_request" ] && [ "${COMMIT_SHA}" != "" ]; then
git pull --quiet
git checkout main
# Then get the changes
CHANGED_FILES=$(git diff --name-only "main...${COMMIT_SHA}" --diff-filter=d templates config/reports.json | grep -v base.html | grep -v main.html | grep -v ejs | grep -v base_ | grep -v sitemap | grep -v error.html | grep -v techreport/components | grep -v techreport/templates | grep -v techreport/report | grep -v techreport/techreport)
CHANGED_FILES=$(git diff --name-only "main...${COMMIT_SHA}" --diff-filter=d templates config/reports.json | grep -v base.html | grep -v main.html | grep -v ejs | grep -v base_ | grep -v sitemap | grep -v error.html | grep -v techreport/components | grep -v techreport/templates | grep -v techreport/report | grep -v techreport/techreport | grep -v 404)
echo "${CHANGED_FILES}"

# Then back to the pull request changes
Expand Down
Loading