fix(frontend): wrap values with special characters in double quotes when downloading a CSV (#3232)

* wrapped values with special characters in double quotes when downloading CSV

* Update AutoDataTable.svelte

---------

Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
This commit is contained in:
gft-kysonnd
2024-02-16 16:17:19 +08:00
committed by GitHub
parent 29d7fa7718
commit aaf02e064c
@@ -161,7 +161,9 @@
return true
}
})
.map(({ rowData }) => Object.values(rowData).join(','))
.map(({ rowData }) => Object.values(rowData)
.map((field) => /[\",\n]/.test(field) ? "\"" + field.replace(/"/g, "\"\"") + "\"" : row)
.join(','))
].join('\n')
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' })