mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-03-05 01:42:45 -05:00
Merge pull request #1932 from alphagov/commas-in-columns
Prevent cells containing commas breaking downloads
This commit is contained in:
@@ -175,7 +175,7 @@ def generate_notifications_csv(**kwargs):
|
||||
notification['created_at'],
|
||||
notification['updated_at']
|
||||
]
|
||||
yield ','.join(map(str, values)) + '\n'
|
||||
yield Spreadsheet.from_rows([map(str, values)]).as_csv_data
|
||||
|
||||
if notifications_resp['links'].get('next'):
|
||||
kwargs['page'] += 1
|
||||
|
||||
@@ -145,6 +145,14 @@ def test_can_create_spreadsheet_from_dict_with_filename():
|
||||
['Row number', 'phone_number', 'a', 'b', 'c', 'Template', 'Type', 'Job', 'Status', 'Time'],
|
||||
['1', '07700900123', '🐜', '🐝', '🦀', 'foo', 'sms', 'bar.csv', 'Delivered', 'Thursday 19 April at 12:00'],
|
||||
),
|
||||
(
|
||||
"""
|
||||
"phone_number", "a", "b", "c"
|
||||
"07700900123","🐜,🐜","🐝,🐝","🦀"
|
||||
""",
|
||||
['Row number', 'phone_number', 'a', 'b', 'c', 'Template', 'Type', 'Job', 'Status', 'Time'],
|
||||
['1', '07700900123', '🐜,🐜', '🐝,🐝', '🦀', 'foo', 'sms', 'bar.csv', 'Delivered', 'Thursday 19 April at 12:00'],
|
||||
),
|
||||
])
|
||||
def test_generate_notifications_csv_returns_correct_csv_file(
|
||||
app_,
|
||||
|
||||
Reference in New Issue
Block a user