diff --git a/src/components/Project/Detail/ProjectFeatureTypes.vue b/src/components/Project/Detail/ProjectFeatureTypes.vue index 633daf91b9315a7df0f9b4e3fd235f450feabfbc..fa88de3e66e19b648fc845c0f5258eff69964bc2 100644 --- a/src/components/Project/Detail/ProjectFeatureTypes.vue +++ b/src/components/Project/Detail/ProjectFeatureTypes.vue @@ -633,10 +633,9 @@ export default { try { fr.readAsText(this.csvFileToImport); fr.onloadend = () => { - let content = fr.result; // Find csv delimiter - const commaDelimited = content.split('\n')[0].includes(','); - const semicolonDelimited = content.split('\n')[0].includes(';'); + const commaDelimited = fr.result.split('\n')[0].includes(','); + const semicolonDelimited = fr.result.split('\n')[0].includes(';'); const delimiter = commaDelimited && !semicolonDelimited ? ',' : semicolonDelimited ? ';' : false; if ((commaDelimited && semicolonDelimited) || !delimiter) { @@ -645,7 +644,7 @@ export default { return; } // Check if file contains 'lat' and 'long' fields - const headers = content + const headers = fr.result .split('\n')[0] .split(delimiter) .map(el => { @@ -657,7 +656,7 @@ export default { // Look for 2 decimal fields in first line of csv // corresponding to lon and lat const sampleLine = - content + fr.result .split('\n')[1] .split(delimiter) .map(el => { @@ -666,7 +665,7 @@ export default { .filter(Boolean); if (sampleLine.length > 1 && headersCoord.length === 2) { this.csvError = null; - this.csvImport = csvToJson(content, delimiter); + this.csvImport = csvToJson(fr.result, delimiter); this.featureTypeImporting = false; //* stock filename to import features afterward this.SET_FILE_TO_IMPORT(this.csvFileToImport);