mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-06-22 08:47:31 +07:00
node_modules: update (#297)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
+26
-7
@@ -95,12 +95,22 @@ module.exports.createTestAccount = function (apiUrl, callback) {
|
||||
requestHeaders.Authorization = 'Bearer ' + ETHEREAL_API_KEY;
|
||||
}
|
||||
|
||||
const req = nmfetch(apiUrl + '/user', {
|
||||
const fetchOptions = {
|
||||
contentType: 'application/json',
|
||||
method: 'POST',
|
||||
headers: requestHeaders,
|
||||
body: Buffer.from(JSON.stringify(requestBody))
|
||||
});
|
||||
};
|
||||
|
||||
// Credential-bearing request to the Ethereal API. lib/fetch already
|
||||
// validates certs by default; pin rejectUnauthorized:true here so this
|
||||
// call stays strict regardless of any future default change and is never
|
||||
// relaxed for a real-cert endpoint.
|
||||
if (/^https:/i.test(apiUrl)) {
|
||||
fetchOptions.tls = { rejectUnauthorized: true };
|
||||
}
|
||||
|
||||
const req = nmfetch(apiUrl + '/user', fetchOptions);
|
||||
|
||||
req.on('readable', () => {
|
||||
let chunk;
|
||||
@@ -137,11 +147,20 @@ module.exports.getTestMessageUrl = function (info) {
|
||||
}
|
||||
|
||||
const infoProps = new Map();
|
||||
info.response.replace(/\[([^\]]+)\]$/, (m, props) => {
|
||||
props.replace(/\b([A-Z0-9]+)=([^\s]+)/g, (m, key, value) => {
|
||||
infoProps.set(key, value);
|
||||
});
|
||||
});
|
||||
|
||||
// Extract the trailing "[...]" part of the response (no "]" allowed inside)
|
||||
// with linear string scanning; the equivalent regex /\[([^\]]+)\]$/ was
|
||||
// flagged for polynomial backtracking on adversarial server responses
|
||||
const response = info.response.toString();
|
||||
if (response.length > 2 && response.charAt(response.length - 1) === ']') {
|
||||
const open = response.indexOf('[', response.lastIndexOf(']', response.length - 2) + 1);
|
||||
if (open >= 0 && open < response.length - 2) {
|
||||
const props = response.substring(open + 1, response.length - 1);
|
||||
props.replace(/\b([A-Z0-9]+)=([^\s]+)/g, (m, key, value) => {
|
||||
infoProps.set(key, value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (infoProps.has('STATUS') && infoProps.has('MSGID')) {
|
||||
return (testAccount.web || ETHEREAL_WEB) + '/message/' + infoProps.get('MSGID');
|
||||
|
||||
Reference in New Issue
Block a user