Remove value of download attribute on links

We should standardise on <a download> rather than
<a download="download"> everywhere. The value of the download attribute
tells the browser what filename to use, but is overridden by the
Content-Disposition HTTP header. Since it’s not being used, we should
remove it for the sake of disambiguation.
This commit is contained in:
Chris Hill-Scott
2018-01-02 14:38:14 +00:00
parent 85b3978061
commit a604ed60b6
7 changed files with 7 additions and 7 deletions

View File

@@ -31,7 +31,7 @@
</p> </p>
{% elif notifications %} {% elif notifications %}
<p class="bottom-gutter"> <p class="bottom-gutter">
<a href="{{ download_link }}" download="download" class="heading-small">Download this report</a> <a href="{{ download_link }}" download class="heading-small">Download this report</a>
&emsp; &emsp;
<span id="time-left">{{ time_left }}</span> <span id="time-left">{{ time_left }}</span>
</p> </p>

View File

@@ -39,7 +39,7 @@
{% if template.template_type != 'letter' or not request.args.from_test %} {% if template.template_type != 'letter' or not request.args.from_test %}
<input type="submit" class="button" value="Send {{ count_of_recipients }} {{ message_count_label(count_of_recipients, template.template_type, suffix='') }}" /> <input type="submit" class="button" value="Send {{ count_of_recipients }} {{ message_count_label(count_of_recipients, template.template_type, suffix='') }}" />
{% else %} {% else %}
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download="download" class="button">Download as a printable PDF</a> <a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a printable PDF</a>
{% endif %} {% endif %}
<a href="{{ back_link }}" class="page-footer-back-link">Back</a> <a href="{{ back_link }}" class="page-footer-back-link">Back</a>
</form> </form>

View File

@@ -4,7 +4,7 @@
<div class="ajax-block-container"> <div class="ajax-block-container">
{% if messages %} {% if messages %}
<p class="bottom-gutter-2-3 top-gutter-2-3"> <p class="bottom-gutter-2-3 top-gutter-2-3">
<a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download="download" class="heading-small">Download these messages</a> <a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download class="heading-small">Download these messages</a>
</p> </p>
{% endif %} {% endif %}
{% call(item, row_number) list_table( {% call(item, row_number) list_table(

View File

@@ -53,7 +53,7 @@
{% if template.template_type != 'letter' or not request.args.from_test %} {% if template.template_type != 'letter' or not request.args.from_test %}
<input type="submit" class="button" value="Send 1 {{ message_count_label(1, template.template_type, suffix='') }}" /> <input type="submit" class="button" value="Send 1 {{ message_count_label(1, template.template_type, suffix='') }}" />
{% else %} {% else %}
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download="download" class="button">Download as a printable PDF</a> <a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a printable PDF</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
<a href="{{ back_link }}" class="page-footer-back-link">Back</a> <a href="{{ back_link }}" class="page-footer-back-link">Back</a>

View File

@@ -35,7 +35,7 @@
Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }} Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }}
</p> </p>
<p class="bottom-gutter"> <p class="bottom-gutter">
<a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download="download">Download as a PDF</a> <a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download>Download as a PDF</a>
</p> </p>
{% endif %} {% endif %}

View File

@@ -40,7 +40,7 @@
{% endcall %} {% endcall %}
</div> </div>
<p class="table-show-more-link"> <p class="table-show-more-link">
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}" download="download">Download this example</a> <a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}" download>Download this example</a>
</p> </p>
<h2 class="heading-medium">Your file will populate this template ({{ template.name }})</h2> <h2 class="heading-medium">Your file will populate this template ({{ template.name }})</h2>

View File

@@ -97,7 +97,7 @@ def test_should_show_page_for_one_job(
job_id=fake_uuid, job_id=fake_uuid,
status=status_argument, status=status_argument,
) )
csv_link = page.find('a', {'download': 'download'}) csv_link = page.select_one('a[download]')
assert csv_link['href'] == url_for( assert csv_link['href'] == url_for(
'main.view_job_csv', 'main.view_job_csv',
service_id=service_one['id'], service_id=service_one['id'],