Skip to content

Scheduling infrastructure for absolutely everyone.

fix: api/routing-forms/responses (#17473)

Benny Jooffc4b69edd80
diff --git a/packages/app-store/routing-forms/api/responses/[formId].ts b/packages/app-store/routing-forms/api/responses/[formId].ts
index d665f7afc32..8b8994a6895 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<SerializableForm<App_RoutingForms_Form>["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 8dcc3b1433d..2dc4cd50e0c 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")}
/>
- <Tooltip content="Download Responses">
+ <Tooltip content={t("download_responses")}>
<FormAction
data-testid="download-responses"
routingForm={form}