fix: normalize inline numbered lists in CSV export

Converts "1) Item. 2) Item." patterns to line-separated items within
quoted CSV cells, matching the frontend normalizeToMarkdown behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
admin
2026-02-25 12:10:28 -05:00
parent cbe7761558
commit 53dd849096

View File

@@ -217,7 +217,10 @@ class CSVExportService {
if (!value) return ''; if (!value) return '';
// Normalize line endings but preserve newlines for readability in spreadsheet cells // Normalize line endings but preserve newlines for readability in spreadsheet cells
const cleanValue = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim(); let cleanValue = value.replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim();
// Convert inline numbered lists "1) ... 2) ..." to line-separated items for readable cells
cleanValue = cleanValue.replace(/\.\s+(\d+)\)\s/g, '.\n$1) ');
// If value contains comma, quote, or newline, wrap in quotes and escape internal quotes // If value contains comma, quote, or newline, wrap in quotes and escape internal quotes
// Excel/Google Sheets render newlines within quoted cells correctly // Excel/Google Sheets render newlines within quoted cells correctly