mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-07 08:27:05 +00:00
fix-csv-export (#20688)
This commit is contained in:
parent
711a2cd738
commit
26e95f2a92
1 changed files with 4 additions and 4 deletions
|
|
@ -53,16 +53,16 @@
|
|||
const exportTableToCSVHandler = (token, tokenIdx = 0) => {
|
||||
console.log('Exporting table to CSV');
|
||||
|
||||
// Extract header row text and escape for CSV.
|
||||
const header = token.header.map((headerCell) => `"${headerCell.text.replace(/"/g, '""')}"`);
|
||||
// Extract header row text, decode HTML entities, and escape for CSV.
|
||||
const header = token.header.map((headerCell) => `"${decode(headerCell.text).replace(/"/g, '""')}"`);
|
||||
|
||||
// Create an array for rows that will hold the mapped cell text.
|
||||
const rows = token.rows.map((row) =>
|
||||
row.map((cell) => {
|
||||
// Map tokens into a single text
|
||||
const cellContent = cell.tokens.map((token) => token.text).join('');
|
||||
// Escape double quotes and wrap the content in double quotes
|
||||
return `"${cellContent.replace(/"/g, '""')}"`;
|
||||
// Decode HTML entities and escape double quotes, wrap in double quotes
|
||||
return `"${decode(cellContent).replace(/"/g, '""')}"`;
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue