Skip to content

Commit

Permalink
Encode recipients due to the space
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanne committed Jan 21, 2025
1 parent 9c65e13 commit 553e544
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/dito/app/routes/vorpruefung.ergebnis/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export async function action({ request }: ActionFunctionArgs) {
const subject = `${emailTemplate.subject}: „${formData.get("title") as string}“`;
const email = formData.get("email");
const cc = email ? `&cc=${email as string}` : "";
const recipients = resolveRecipients(result);
const recipients = encodeURIComponent(resolveRecipients(result));
const body = buildEmailBody(
preCheckAnswers,
result,
Expand Down
6 changes: 4 additions & 2 deletions packages/dito/tests/e2e/resultForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function interceptMailToRedirectAndExpect(
if (expected?.subject)
expect(mailTo.searchParams.get("subject")).toBe(expected?.subject);
expected?.recipients?.forEach((expectedRecipient) =>
expect(mailTo.pathname).toContain(expectedRecipient),
expect(decodeURIComponent(mailTo.pathname)).toContain(expectedRecipient),
);
expected?.cc?.forEach((expectedCC) =>
expect(mailTo.searchParams.get("cc")).toContain(expectedCC),
Expand All @@ -46,7 +46,9 @@ async function interceptMailToRedirectAndExpect(
});

notExpected?.recipients?.forEach((notExpectedRecipient) =>
expect(mailTo.pathname).not.toContain(notExpectedRecipient),
expect(decodeURIComponent(mailTo.pathname)).not.toContain(
notExpectedRecipient,
),
);
notExpected?.body?.forEach((notExpectedString) => {
expect(mailTo.searchParams.get("body")).not.toContain(notExpectedString);
Expand Down

0 comments on commit 553e544

Please sign in to comment.