Skip to content

Commit 26e95f2

Browse files
authored
fix-csv-export (open-webui#20688)
1 parent 711a2cd commit 26e95f2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@
5353
const exportTableToCSVHandler = (token, tokenIdx = 0) => {
5454
console.log('Exporting table to CSV');
5555
56-
// Extract header row text and escape for CSV.
57-
const header = token.header.map((headerCell) => `"${headerCell.text.replace(/"/g, '""')}"`);
56+
// Extract header row text, decode HTML entities, and escape for CSV.
57+
const header = token.header.map((headerCell) => `"${decode(headerCell.text).replace(/"/g, '""')}"`);
5858
5959
// Create an array for rows that will hold the mapped cell text.
6060
const rows = token.rows.map((row) =>
6161
row.map((cell) => {
6262
// Map tokens into a single text
6363
const cellContent = cell.tokens.map((token) => token.text).join('');
64-
// Escape double quotes and wrap the content in double quotes
65-
return `"${cellContent.replace(/"/g, '""')}"`;
64+
// Decode HTML entities and escape double quotes, wrap in double quotes
65+
return `"${decode(cellContent).replace(/"/g, '""')}"`;
6666
})
6767
);
6868

0 commit comments

Comments
 (0)