mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-19 05:59:44 -04:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user