Skip to content

Commit

Permalink
YDA-5950: fix group import with newlines at EOF
Browse files Browse the repository at this point in the history
This ensures CSV group imports in the group manager work correctly if
the CSV file has multiple trailing newlines.
  • Loading branch information
leonidastri authored Sep 17, 2024
1 parent 92394a8 commit df351a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions group_manager/static/group_manager/js/group_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ function readCsvFile (e) {
// remove unwanted characters
contents = contents.replaceAll('"', '').replaceAll("'", '').replaceAll(' ', '').replaceAll('\r', '')

// remove extra newline at end of file
if (contents[contents.length - 1] === '\n') {
// remove extra newline(s) at end of file
while (contents[contents.length - 1] === '\n') {
contents = contents.slice(0, contents.length - 1)
}

Expand Down

0 comments on commit df351a2

Please sign in to comment.