From e1bbcbc8bbfb8dc2b5ae75ae3e9ae1c3c8295db1 Mon Sep 17 00:00:00 2001 From: Rajat Dabade Date: Tue, 10 Sep 2024 11:01:32 +0530 Subject: [PATCH] MM-53298: Fix the export to CSV issue if card property contains # (#17) --- webapp/src/csvExporter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/csvExporter.ts b/webapp/src/csvExporter.ts index 75cbd3b14..3ee74a555 100644 --- a/webapp/src/csvExporter.ts +++ b/webapp/src/csvExporter.ts @@ -15,21 +15,21 @@ const hashSignToken = '___hash_sign___' class CsvExporter { static exportTableCsv(board: Board, activeView: BoardView, cards: Card[], intl: IntlShape, view?: BoardView): void { const viewToExport = view ?? activeView - + if (!viewToExport) { return } const rows = CsvExporter.generateTableArray(board, cards, viewToExport, intl) - let csvContent = 'data:text/csv;charset=utf-8,' + let csvContent = '' rows.forEach((row) => { const encodedRow = row.join(',') csvContent += encodedRow + '\r\n' }) - const encodedUri = encodeURI(csvContent).replace(hashSignToken, '%23') + const encodedUri = 'data:text/csv;charset=utf-8,' + encodeURIComponent(csvContent) const filename = `${Utils.sanitizeFilename(viewToExport.title || 'Untitled')}.csv` const link = document.createElement('a')