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 <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-18 22:25:40 -07:00
parent e05cfc3375
commit 267f2cb2c4
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
14 changed files with 58 additions and 58 deletions

View file

@ -6,7 +6,7 @@
{{ "Use this form to search existing accounts." | tr }}
<br />
<br />
<form class="account-search-form" action="/accounts/" method="post">
<form class="account-search-form" action="/accounts" method="post">
<fieldset>
<p>
<label for="id_username">{{ "Username" | tr }}:</label>

View file

@ -8,7 +8,7 @@
<div class="box">
<h2>{{ "Submit a proposal to vote on." | tr }}</h2>
<form action="/addvote/" method="post">
<form action="/addvote" method="post">
<p class="vote-applicant">
<label for="id_user">{{ "Applicant/TU" | tr }}</label>

View file

@ -6,7 +6,7 @@
<h2>AUR {% trans %}Login{% endtrans %}</h2>
{% if request.url.scheme == "http" and config.getboolean("options", "disable_http_login") %}
{% set https_login = url_base.replace("http://", "https://") + "/login/" %}
{% set https_login = url_base.replace("http://", "https://") + "/login" %}
<p>
{{ "HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."
| tr
@ -23,7 +23,7 @@
| format("<b>%s</b>" | format(request.user.Username))
| safe
}}
<a href="/logout/?next={{ next }}">[{% trans %}Logout{% endtrans %}]</a>
<a href="/logout?next={{ next }}">[{% trans %}Logout{% endtrans %}]</a>
</p>
{% else %}
<form method="post" action="/login?next={{ next }}">
@ -70,7 +70,7 @@
<p>
<input class="button" type="submit"
value="{% trans %}Login{% endtrans %}">
<a href="/passreset/">
<a href="/passreset">
[{% trans %}Forgot Password{% endtrans %}]
</a>
<input id="id_referer" type="hidden" name="referer"

View file

@ -40,7 +40,7 @@
<table class="results">
<tr>
<td align="left">
<form action="/accounts/" method="post">
<form action="/accounts" method="post">
<fieldset>
<input type="hidden" name="O"
value="{{ offset - pp }}" />
@ -59,7 +59,7 @@
</form>
</td>
<td align="right">
<form action="/accounts/" method="post">
<form action="/accounts" method="post">
<fieldset>
<input type="hidden" name="O"
value="{{ offset + pp }}" />

View file

@ -5,16 +5,16 @@
{% else %}
<li><a href="/">AUR {% trans %}Home{% endtrans %}</a></li>
{% endif %}
<li><a href="/packages/">{% trans %}Packages{% endtrans %}</a></li>
<li><a href="/packages">{% trans %}Packages{% endtrans %}</a></li>
{% if request.user.is_authenticated() %}
<li>
<a href="/requests/">
<a href="/requests">
{% trans %}Requests{% endtrans %}
</a>
</li>
{% if request.user.is_trusted_user() or request.user.is_developer() %}
<li>
<a href="/accounts/">
<a href="/accounts">
{% trans %}Accounts{% endtrans %}
</a>
</li>
@ -32,7 +32,7 @@
{% endif %}
<li>
<a href="/logout/?next={{ next }}">
<a href="/logout?next={{ next }}">
{% trans %}Logout{% endtrans %}
</a>
</li>
@ -43,7 +43,7 @@
</a>
</li>
<li>
<a href="/login/?next={{ next }}">
<a href="/login?next={{ next }}">
{% trans %}Login{% endtrans %}
</a>
</li>

View file

@ -10,7 +10,7 @@
<!-- Alternate resources -->
<link rel="alternate" type="application/rss+xml"
title="Newest Packages RSS" href="/rss/">
title="Newest Packages RSS" href="/rss">
<!-- Include local typeahead -->
<script type="text/javascript" src="/static/js/typeahead.js"></script>

View file

@ -26,7 +26,7 @@
</li>
{% if not out_of_date %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/flag/">
<a href="/pkgbase/{{ pkgbase.Name }}/flag">
{{ "Flag package out-of-date" | tr }}
</a>
</li>
@ -52,14 +52,14 @@
{% endif %}
<li>
{% if not voted %}
<form action="/pkgbase/{{ pkgbase.Name }}/vote/" method="post">
<form action="/pkgbase/{{ pkgbase.Name }}/vote" method="post">
<input type="submit"
class="button text-button"
name="do_Vote"
value="{{ 'Vote for this package' | tr }}" />
</form>
{% else %}
<form action="/pkgbase/{{ pkgbase.Name }}/unvote/" method="post">
<form action="/pkgbase/{{ pkgbase.Name }}/unvote" method="post">
<input type="submit"
class="button text-button"
name="do_UnVote"
@ -69,7 +69,7 @@
</li>
<li>
{% if notified %}
<form action="/pkgbase/{{ pkgbase.Name }}/unnotify/" method="post">
<form action="/pkgbase/{{ pkgbase.Name }}/unnotify" method="post">
<input type="submit"
class="button text-button"
name="do_UnNotify"
@ -77,7 +77,7 @@
/>
</form>
{% else %}
<form action="/pkgbase/{{ pkgbase.Name }}/notify/" method="post">
<form action="/pkgbase/{{ pkgbase.Name }}/notify" method="post">
<input type="submit"
class="button text-button"
name="do_Notify"
@ -88,7 +88,7 @@
</li>
{% if request.user.has_credential('CRED_PKGBASE_EDIT_COMAINTAINERS', approved=[pkgbase.Maintainer]) %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/comaintainers/">
<a href="/pkgbase/{{ pkgbase.Name }}/comaintainers">
{{ "Manage Co-Maintainers" | tr }}
</a>
</li>
@ -101,20 +101,20 @@
</li>
{% endif %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/request/">
<a href="/pkgbase/{{ pkgbase.Name }}/request">
{{ "Submit Request" | tr }}
</a>
</li>
{% if request.user.has_credential("CRED_PKGBASE_DELETE") %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/delete/">
<a href="/pkgbase/{{ pkgbase.Name }}/delete">
{{ "Delete Package" | tr }}
</a>
</li>
{% endif %}
{% if request.user.has_credential("CRED_PKGBASE_MERGE") %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/merge/">
<a href="/pkgbase/{{ pkgbase.Name }}/merge">
{{ "Merge Package" | tr }}
</a>
</li>
@ -130,7 +130,7 @@
</li>
{% elif request.user.has_credential("CRED_PKGBASE_DISOWN", approved=[pkgbase.Maintainer]) %}
<li>
<a href="/pkgbase/{{ pkgbase.Name }}/disown/">
<a href="/pkgbase/{{ pkgbase.Name }}/disown">
{{ "Disown Package" | tr }}
</a>
</li>

View file

@ -38,7 +38,7 @@
{% if request.user.has_credential("CRED_PKGBASE_SET_KEYWORDS", approved=[pkgbase.Maintainer]) %}
<td>
<form method="update"
action="/pkgbase/{{ pkgbase.Name }}/keywords/"
action="/pkgbase/{{ pkgbase.Name }}/keywords"
>
<div>
<input type="text"

View file

@ -3,7 +3,7 @@
<ul>
{% for result in packages %}
<li>
<a href="/packages/{{ result.Name }}/"
<a href="/packages/{{ result.Name }}"
title="{{ 'View packages details for' | tr }} {{ result.Name }}">
{{ result.Name }}
</a>

View file

@ -1,5 +1,5 @@
<div id="pkgsearch" class="widget">
<form id="pkgsearch-form" method="get" action="/packages/">
<form id="pkgsearch-form" method="get" action="/packages">
<fieldset>
<label for="pkgsearch-field">{{ "Package Search" | tr }}:</label>
<input type="hidden" name="O" value="0" />

View file

@ -5,7 +5,7 @@
(<a href="/packages/?SB=l&SO=d">{{ "more" | tr }}</a>)
</span>
</h3>
<a class="rss-icon latest" href="/rss/"
<a class="rss-icon latest" href="/rss"
title="AUR Latest Packages RSS Feed">
<img src="/static/images/rss.svg" alt="RSS Feed" />
</a>

View file

@ -4,7 +4,7 @@
{% if title == "Current Votes" %}
<ul class="admin-actions">
<li>
<a href="/addvote/">
<a href="/addvote">
{% trans %}Add Proposal{% endtrans %}
</a>
</li>