From 267f2cb2c4e0a8cf69269f445acc7ccf49fa8faa Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Mon, 18 Oct 2021 22:25:40 -0700 Subject: [PATCH] fix(fastapi): remove trailing slashes from fastapi-driven links With our FastAPI server, trailing slashes causes a 307 redirect which ends up redirecting users to routes which do not contain trailing slashes. This removes trailing slashes from our templates where FastAPI is concerned to avoid unnecessary redirects. There may still be links or usages around which have unnecessary usages of a trailing slash; please keep a look out for these and remove them where possible. Signed-off-by: Kevin Morris --- aurweb/routers/accounts.py | 8 +-- templates/account/search.html | 2 +- templates/addvote.html | 2 +- templates/login.html | 6 +-- templates/partials/account/results.html | 4 +- templates/partials/archdev-navbar.html | 10 ++-- templates/partials/head.html | 2 +- templates/partials/packages/actions.html | 20 +++---- templates/partials/packages/details.html | 2 +- .../partials/packages/pkgbase_metadata.html | 2 +- .../partials/packages/widgets/search.html | 2 +- .../partials/packages/widgets/updates.html | 2 +- templates/partials/tu/proposals.html | 2 +- test/test_accounts_routes.py | 52 +++++++++---------- 14 files changed, 58 insertions(+), 58 deletions(-) diff --git a/aurweb/routers/accounts.py b/aurweb/routers/accounts.py index a9257d3d..4c4ce849 100644 --- a/aurweb/routers/accounts.py +++ b/aurweb/routers/accounts.py @@ -590,8 +590,8 @@ async def account(request: Request, username: str): return render_template(request, "account/show.html", context) -@router.get("/accounts/") -@auth_required(True, redirect="/accounts/") +@router.get("/accounts") +@auth_required(True, redirect="/accounts") @account_type_required({account_type.TRUSTED_USER, account_type.DEVELOPER, account_type.TRUSTED_USER_AND_DEV}) @@ -600,8 +600,8 @@ async def accounts(request: Request): return render_template(request, "account/search.html", context) -@router.post("/accounts/") -@auth_required(True, redirect="/accounts/") +@router.post("/accounts") +@auth_required(True, redirect="/accounts") @account_type_required({account_type.TRUSTED_USER, account_type.DEVELOPER, account_type.TRUSTED_USER_AND_DEV}) diff --git a/templates/account/search.html b/templates/account/search.html index 3f83d25b..d28d4169 100644 --- a/templates/account/search.html +++ b/templates/account/search.html @@ -6,7 +6,7 @@ {{ "Use this form to search existing accounts." | tr }}

-