diff --git a/packages/app-store/routing-forms/api/responses/[formId].ts b/packages/app-store/routing-forms/api/responses/[formId].ts index d665f7afc3..8b8994a689 100644 --- a/packages/app-store/routing-forms/api/responses/[formId].ts +++ b/packages/app-store/routing-forms/api/responses/[formId].ts @@ -2,6 +2,7 @@ import type { App_RoutingForms_Form } from "@prisma/client"; import type { NextApiRequest, NextApiResponse } from "next"; import { getSession } from "next-auth/react"; +import { sanitizeValue } from "@calcom/lib/csvUtils"; import { entityPrismaWhereClause, canEditEntity } from "@calcom/lib/entityPermissionUtils"; import prisma from "@calcom/prisma"; @@ -10,9 +11,6 @@ import { ensureStringOrStringArray, getLabelsFromOptionIds } from "../../lib/rep import type { FormResponse, SerializableForm } from "../../types/types"; type Fields = NonNullable["fields"]>; -function escapeCsvText(str: string) { - return str.replace(/,/, "%2C"); -} function getHumanReadableFieldResponseValue({ field, @@ -52,9 +50,8 @@ async function* getResponses(formId: string, fields: Fields) { fields.forEach((field) => { const fieldResponse = fieldResponses[field.id]; const value = fieldResponse?.value || ""; - const serializedValue = getHumanReadableFieldResponseValue({ field, value }) - .map((value) => escapeCsvText(value)) - .join(" | "); + const readableValues = getHumanReadableFieldResponseValue({ field, value }); + const serializedValue = readableValues.map((value) => sanitizeValue(value)).join(" | "); csvCells.push(serializedValue); }); csvCells.push(response.createdAt.toISOString()); diff --git a/packages/app-store/routing-forms/components/SingleForm.tsx b/packages/app-store/routing-forms/components/SingleForm.tsx index 8dcc3b1433..2dc4cd50e0 100644 --- a/packages/app-store/routing-forms/components/SingleForm.tsx +++ b/packages/app-store/routing-forms/components/SingleForm.tsx @@ -98,7 +98,7 @@ const Actions = ({ tooltip={t("copy_link_to_form")} /> - +