From 66e6538d95ecee90ff6e6302b71a3ea7c548fce7 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 30 Apr 2018 10:06:33 +0100 Subject: [PATCH] Store original filename as S3 metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By doing this we no longer have to store it in the session. This is the last thing that’s currently in the session, so removing it means we can drop session storage for file uploads entirely. --- app/main/views/send.py | 1 + tests/app/main/views/test_send.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/main/views/send.py b/app/main/views/send.py index dd9d22231..1e01370e0 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -555,6 +555,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_ notification_count=len(recipients), template_id=str(template_id), valid=True, + original_file_name=request.args.get('original_file_name'), ) else: session['file_uploads'].pop(upload_id) diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 15b2fb5e5..41e172ab2 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -590,6 +590,7 @@ def test_upload_valid_csv_shows_preview_and_table( service_id=SERVICE_ONE_ID, template_id=fake_uuid, upload_id=fake_uuid, + original_file_name='example.csv', **extra_args ) @@ -599,6 +600,7 @@ def test_upload_valid_csv_shows_preview_and_table( notification_count=3, template_id=fake_uuid, valid=True, + original_file_name='example.csv', ) assert page.h1.text.strip() == 'Preview of Two week reminder' @@ -1506,6 +1508,7 @@ def test_upload_csvfile_with_valid_phone_shows_all_numbers( notification_count=53, template_id=fake_uuid, valid=True, + original_file_name='valid.csv', ) content = response.get_data(as_text=True)