mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 00:20:43 -04:00
Put filename in metadata when sending via a CSV
When sending from an uploaded CSV `.send_messages` now puts the filename in the metadata. It previously used the query string to pass the filename to `.check_messages`, where it can be lost.
This commit is contained in:
@@ -159,12 +159,20 @@ def send_messages(service_id, template_id):
|
||||
Spreadsheet.from_file_form(form).as_dict,
|
||||
current_app.config['AWS_REGION']
|
||||
)
|
||||
file_name_metadata = unicode_truncate(
|
||||
SanitiseASCII.encode(form.file.data.filename),
|
||||
1600
|
||||
)
|
||||
set_metadata_on_csv_upload(
|
||||
service_id,
|
||||
upload_id,
|
||||
original_file_name=file_name_metadata
|
||||
)
|
||||
return redirect(url_for(
|
||||
'.check_messages',
|
||||
service_id=service_id,
|
||||
upload_id=upload_id,
|
||||
template_id=template.id,
|
||||
original_file_name=form.file.data.filename,
|
||||
))
|
||||
except (UnicodeDecodeError, BadZipFile, XLRDError):
|
||||
flash('Could not read {}. Try using a different file format.'.format(
|
||||
|
||||
Reference in New Issue
Block a user