From 977c319f67270d12dbb16388c65c848dd2e7298d Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 24 Sep 2024 17:24:45 +0200 Subject: [PATCH] fix: better replace with regex --- src/utils/report.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/report.ts b/src/utils/report.ts index f73e982..5da6e0f 100644 --- a/src/utils/report.ts +++ b/src/utils/report.ts @@ -88,16 +88,16 @@ export const getReportCSV = async (data: ReportTimeEntry[]): Promise => [ entry.date, entry.email, - '"' + entry.name?.replace('"', '\\"') + '"', + '"' + entry.name?.replace('/"/g', '\\"') + '"', entry.company, entry.crew, - '"' + entry.customer.replace('"', '\\"') + '"', - '"' + entry.task.name.replace('"', '\\"') + '"', - '"' + entry.project.name.replace('"', '\\"') + '"', + '"' + entry.customer.replace('/"/g', '\\"') + '"', + '"' + entry.task.name.replace('/"/g', '\\"') + '"', + '"' + entry.project.name.replace('/"/g', '\\"') + '"', entry.project.type, entry.project.plannedHours, entry.hours, - '"' + entry.description?.replace('"', '\\"') + '"', + '"' + entry.description?.replace('/"/g', '\\"') + '"', entry.startHour, entry.endHour, ].join(',') + '\n';