Skip to content

Commit

Permalink
fix: explicitly use URLSearchParams when constructing send to email m…
Browse files Browse the repository at this point in the history
…agic links (#4138)
  • Loading branch information
jessicamcinchak authored Jan 13, 2025
1 parent db16a4c commit 5420338
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api.planx.uk/modules/send/email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ export const sendToEmail: SendIntegrationController = async (
const { email, flow } = await getSessionEmailDetailsById(sessionId);
const flowName = flow.name;

// Make application files download magic link
const params = new URLSearchParams({
email: teamSettings.submissionEmail,
localAuthority: localAuthority,
});
const applicationFilesDownloadLink = `${process.env.API_URL_EXT}/download-application-files/${sessionId}?${params}`;

// Prepare email template
const config: EmailSubmissionNotifyConfig = {
personalisation: {
serviceName: flowName,
sessionId,
applicantEmail: email,
downloadLink: `${process.env.API_URL_EXT}/download-application-files/${sessionId}?email=${teamSettings.submissionEmail}&localAuthority=${localAuthority}`,
downloadLink: applicationFilesDownloadLink,
...teamSettings,
},
};
Expand Down

0 comments on commit 5420338

Please sign in to comment.