Skip to content

Commit 3bc3ad8

Browse files
committed
Chore: copy data argument to avoid mutate origin.
copy data argument passed to mail.send method to avoid mutate original variable
1 parent b8125d8 commit 3bc3ad8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/mail/src/classes/mail-service.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,20 @@ class MailService {
180180
//Send mail
181181
try {
182182

183+
// copy object to avoid mutating original
184+
const args = data;
183185
//Append multiple flag to data if not set
184186
if (typeof data.isMultiple === 'undefined') {
185-
data.isMultiple = isMultiple;
187+
args.isMultiple = isMultiple;
186188
}
187189

188190
//Append global substitution wrappers if not set in data
189191
if (typeof data.substitutionWrappers === 'undefined') {
190-
data.substitutionWrappers = this.substitutionWrappers;
192+
args.substitutionWrappers = this.substitutionWrappers;
191193
}
192194

193195
//Create Mail instance from data and get JSON body for request
194-
const mail = Mail.create(data);
196+
const mail = Mail.create(args);
195197
const body = mail.toJSON();
196198

197199
//Filters the Mail body to avoid sensitive content leakage

0 commit comments

Comments
 (0)