From de7d7e9e9d104b806fdc7d624ff6b16861af6b3b Mon Sep 17 00:00:00 2001 From: Andrew Ardill Date: Wed, 15 Jul 2020 00:52:02 +1000 Subject: [PATCH] Handle different EOL formats when loading data When cloning the data files with git the line endings can be changed depending on git autocrlf settings. If there are any carriage returns the parsing fails, so we need to either avoid them or strip them. This change, stripping the carriage returns in addition to the line feeds, is the simplest and has the benefit of also handling any future situation where carriage returns are added to the source files. --- process/src/Category.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/src/Category.js b/process/src/Category.js index 68b6ef48d..013c95ae6 100644 --- a/process/src/Category.js +++ b/process/src/Category.js @@ -4,7 +4,7 @@ class Category { constructor(dataText) { this.objectIDs = []; this.objectWeights = []; - const lines = dataText.split('\n'); + const lines = dataText.split(/[\r\n]+/); let headers = true; for (let line of lines) { if (headers) {