Stop checking query string for filename if uploading contact list

The code was looking for `original_file_name` in the metadata for a
contact list, or the query string if it wasn't in the metadata. Now that
the change to use the metadata for the file name has been deployed for a
while e can stop looking in the query string for the
`original_file_name`.
This commit is contained in:
Katie Smith
2020-10-27 10:35:24 +00:00
parent cebdf7afa1
commit 18e4e86565
2 changed files with 2 additions and 71 deletions

View File

@@ -427,20 +427,13 @@ def check_contact_list(service_id, upload_id):
contents = ContactList.download(service_id, upload_id)
first_row = contents.splitlines()[0].strip().rstrip(',') if contents else ''
metadata = ContactList.get_metadata(service_id, upload_id)
original_file_name = ContactList.get_metadata(service_id, upload_id).get('original_file_name', '')
template_type = {
'emailaddress': 'email',
'phonenumber': 'sms',
}.get(Columns.make_key(first_row))
# TODO: stop looking in the query string for metadata once we are sure all uploaded
# contact lists now have original_file_name in the metadata
original_file_name = metadata.get(
'original_file_name',
SanitiseASCII.encode(request.args.get('original_file_name', ''))
)
recipients = RecipientCSV(
contents,
template=get_sample_template(template_type or 'sms'),
@@ -493,10 +486,7 @@ def check_contact_list(service_id, upload_id):
metadata_kwargs = {
'row_count': len(recipients),
'valid': True,
'original_file_name': unicode_truncate(
original_file_name,
1600,
),
'original_file_name': original_file_name,
'template_type': template_type
}