Commit 3fa33866 authored by Anton's avatar Anton

Fix escaping in CSV export

parent b8fbd9e3
......@@ -10,7 +10,9 @@ and this project adheres to
## [Unreleased]
- No changes
### Fixed
- Replace newlines in CSV export
## [1.3.10] - 2020-02-14
......
......@@ -42,7 +42,7 @@ const exportCSV = async function (items, filename) {
}
let csvData = 'data:text/csv;charset=utf-8,'
entries.forEach(entry => {
csvData += entry.map(v => `"${(v || '').toString().replace('"', '\\"').replace(';', '\\;')}"`).join(';') + '\r\n'
csvData += entry.map(v => `"${(v || '').toString().replace(/"/g, '""')}"`).join(';') + '\r\n'
})
const download = document.createElement('a')
download.setAttribute('href', encodeURI(csvData))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment