Skip to content
Snippets Groups Projects
Commit 88d1ba0d authored by Florent Lavelle's avatar Florent Lavelle
Browse files

minor fix

parent 96a910b2
No related branches found
No related tags found
2 merge requests!424version 3.1.0,!353REDMINE_ISSUE-13365 | Fix import CSV
......@@ -18,7 +18,9 @@ export function csvToJson(csv, delimiter) {
const result = [];
const allLines = csv.split('\n');
const headers = allLines[0].split(delimiter);
const headers = allLines[0].split(delimiter).map(el => {
return el.replace('\r', '');
});
const [, ...lines] = allLines;
for (const line of lines) {
......
......@@ -607,6 +607,9 @@ export default {
fr.result
.split('\n')[0]
.split(delimiter)
.map(el => {
return el.replace('\r', '');
})
.filter(el => {
return el === 'lat' || el === 'lon';
});
......@@ -621,7 +624,6 @@ export default {
return !isNaN(el) && el.indexOf('.') != -1;
})
.filter(Boolean);
if (sampleLine.length > 1 && headersLine.length === 2) {
this.csvError = null;
this.csvImport = csvToJson(fr.result, delimiter);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment