Commit fcf77658 authored by Anton Koch's avatar Anton Koch
Browse files

Resolve "CSV export broken"

parent c221e5ba
...@@ -13,6 +13,13 @@ and this project adheres to ...@@ -13,6 +13,13 @@ and this project adheres to
No changes. No changes.
## [2.4.1] - 2020-12-28
### Fixed
- CSV Export breaks when `#` characters are used in the Annotation values.
## [2.4.0] - 2020-11-09 ## [2.4.0] - 2020-11-09
### Added ### Added
...@@ -556,7 +563,8 @@ of a video cannot be retrieved ...@@ -556,7 +563,8 @@ of a video cannot be retrieved
- Start proper versioning at 1.0.0 - Start proper versioning at 1.0.0
[Unreleased]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.4.0...release_2_4 [Unreleased]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.4.1...release_2_4
[2.4.1]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.4.0...v2.4.1
[2.4.0]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.3.1...v2.4.0 [2.4.0]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.3.1...v2.4.0
[2.3.1]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.3.0...v2.3.1 [2.3.1]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.3.0...v2.3.1
[2.3.0]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.2.1...v2.3.0 [2.3.0]: https://gitlab.rlp.net/motionbank/applications/systems-frontend/compare/v2.2.1...v2.3.0
......
...@@ -25,12 +25,15 @@ const exportCSV = function (items, filename = undefined) { ...@@ -25,12 +25,15 @@ const exportCSV = function (items, filename = undefined) {
annotation._updated || '' annotation._updated || ''
] ]
})) }))
let csvData = 'data:text/csv;charset=utf-8,' // let csvData = 'data:text/csv;base64,'
let dataUrl = encodeURI('data:text/csv;charset=utf-8,')
let csvData = ''
entries.forEach(entry => { entries.forEach(entry => {
csvData += entry.map(v => `"${(v || '').toString().replace('"', '\\"')}"`).join(';') + '\r\n' csvData += entry.map(v => `"${(v || '').toString().replace('"', '\\"')}"`).join(';') + '\r\n'
}) })
dataUrl += encodeURIComponent(csvData)
const download = document.createElement('a') const download = document.createElement('a')
download.setAttribute('href', encodeURI(csvData)) download.setAttribute('href', dataUrl)
if (filename) download.setAttribute('download', filename) if (filename) download.setAttribute('download', filename)
return download return download
......
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