@@ -46,7 +46,7 @@ export const executeSendEmailBlock = async (
|
|||||||
credentialsId: options.credentialsId,
|
credentialsId: options.credentialsId,
|
||||||
recipients: options.recipients.map(parseVariables(variables)),
|
recipients: options.recipients.map(parseVariables(variables)),
|
||||||
subject: parseVariables(variables)(options.subject ?? ''),
|
subject: parseVariables(variables)(options.subject ?? ''),
|
||||||
body: parseVariables(variables)(options.body ?? ''),
|
body: parseVariables(variables, { escapeHtml: true })(options.body ?? ''),
|
||||||
cc: (options.cc ?? []).map(parseVariables(variables)),
|
cc: (options.cc ?? []).map(parseVariables(variables)),
|
||||||
bcc: (options.bcc ?? []).map(parseVariables(variables)),
|
bcc: (options.bcc ?? []).map(parseVariables(variables)),
|
||||||
replyTo: options.replyTo
|
replyTo: options.replyTo
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ export type ParseVariablesOptions = {
|
|||||||
fieldToParse?: 'value' | 'id'
|
fieldToParse?: 'value' | 'id'
|
||||||
escapeForJson?: boolean
|
escapeForJson?: boolean
|
||||||
takeLatestIfList?: boolean
|
takeLatestIfList?: boolean
|
||||||
|
escapeHtml?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultParseVariablesOptions: ParseVariablesOptions = {
|
export const defaultParseVariablesOptions: ParseVariablesOptions = {
|
||||||
fieldToParse: 'value',
|
fieldToParse: 'value',
|
||||||
escapeForJson: false,
|
escapeForJson: false,
|
||||||
takeLatestIfList: false,
|
takeLatestIfList: false,
|
||||||
|
escapeHtml: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseVariables =
|
export const parseVariables =
|
||||||
@@ -50,6 +52,8 @@ export const parseVariables =
|
|||||||
: value
|
: value
|
||||||
)
|
)
|
||||||
if (!parsedValue) return dollarSign + ''
|
if (!parsedValue) return dollarSign + ''
|
||||||
|
if (options.escapeHtml)
|
||||||
|
return parsedValue.replace(/</g, '<').replace(/>/g, '>')
|
||||||
return parsedValue
|
return parsedValue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user