From 6896488451ba854421b5e89c089b54fc2f08166a Mon Sep 17 00:00:00 2001 From: R2bEEaton Date: Mon, 22 Aug 2022 07:59:05 -0400 Subject: [PATCH] Import Users CSV Carriage Return Support #7398 ## Description The ImportUsersModal takes in a CSV file expecting each line to have a valid email address. When this file is created in Microsoft Excel, Windows in general, or a text editor that uses the carriage return character `\r`, the import fails. This is because the CSV string is split into an email list by `csvString.split("\n")` which fails to account for `\r\n` newlines. This PR changes the split to be the regex `/\r?\n/` which will split on either `\n` or `\r\n`. Addresses: - Issue #7398 - Discussion #7397 --- .../portal/manage/users/_components/ImportUsersModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/ImportUsersModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/ImportUsersModal.svelte index 1e7c579346..d6ea4275c9 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/ImportUsersModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/ImportUsersModal.svelte @@ -62,7 +62,7 @@ csvString = e.target.result files = fileArray - userEmails = csvString.split("\n") + userEmails = csvString.split(/\r?\n/) }) reader.readAsText(fileArray[0]) }