Remove extraneous trailing slashes from link URLs

Previously, some links would have double slashes at the end, one from
url_for and one from the HTML template. This would cause a 404 if the
user attempted to follow the link.

Additionally, use url_for instead of manually building the link for the
unified diff.

Change-Id: Ic576c13c6785bd5ac47aa4095fb5e42dd774dc9e
This commit is contained in:
Tim Burke 2016-01-11 10:43:55 -08:00
parent 3ce6e2e91b
commit 1e07199441
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@
<p>
Differences between the pastes
<a href="{{ old.url|e }}">#{{ old.identifier }}</a> ({{ old.pub_date|datetimeformat }})
and <a href="{{ new.url|e }}">#{{ new.identifier }}</a> ({{ new.pub_date|datetimeformat }}). Download as <a href="/unidiff/{{ old.identifier }}/{{ new.identifier }}/">unified diff</a>.
and <a href="{{ new.url|e }}">#{{ new.identifier }}</a> ({{ new.pub_date|datetimeformat }}). Download as <a href="{{ url_for('pastes/unidiff_paste', new_id=new.identifier, old_id=old.identifier ) }}">unified diff</a>.
</p>
{% if diff.chunks %}
{{ render_diff_part(diff) }}

View File

@ -27,7 +27,7 @@
{% if paste.parent %}
<li>
<a class="autoclose"
href="{{ url_for('pastes/compare_paste', new_id=paste.identifier, old_id=paste.parent.identifier ) }}/">
href="{{ url_for('pastes/compare_paste', new_id=paste.identifier, old_id=paste.parent.identifier ) }}">
{% trans %}compare it with the parent paste{% endtrans %}
</a>
</li>
@ -49,13 +49,13 @@
{% endif %}
{% if paste.parent or paste.children %}
<li>
<a href="{{ url_for('pastes/show_tree', identifier=paste.identifier) }}/">
<a href="{{ url_for('pastes/show_tree', identifier=paste.identifier) }}">
{% trans %}show paste tree{% endtrans %}
</a>
</li>
{% endif %}
<li>
<a href="{{ url_for('pastes/raw_paste', identifier=paste.identifier) }}/">
<a href="{{ url_for('pastes/raw_paste', identifier=paste.identifier) }}">
{% trans %}download paste{% endtrans %}
</a>
</li>