mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-05-06 17:30:35 +07:00
node_modules: update (#290)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
65
node_modules/nodemailer/lib/mime-funcs/index.js
generated
vendored
65
node_modules/nodemailer/lib/mime-funcs/index.js
generated
vendored
@@ -15,11 +15,7 @@ module.exports = {
|
||||
*/
|
||||
isPlainText(value, isParam) {
|
||||
const re = isParam ? /[\x00-\x08\x0b\x0c\x0e-\x1f"\u0080-\uFFFF]/ : /[\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]/;
|
||||
if (typeof value !== 'string' || re.test(value)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return typeof value === 'string' && !re.test(value);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -54,7 +50,7 @@ module.exports = {
|
||||
maxLength = maxLength || 0;
|
||||
|
||||
let encodedStr;
|
||||
let toCharset = 'UTF-8';
|
||||
const toCharset = 'UTF-8';
|
||||
|
||||
if (maxLength && maxLength > 7 + toCharset.length) {
|
||||
maxLength -= 7 + toCharset.length;
|
||||
@@ -63,12 +59,11 @@ module.exports = {
|
||||
if (mimeWordEncoding === 'Q') {
|
||||
// https://tools.ietf.org/html/rfc2047#section-5 rule (3)
|
||||
encodedStr = qp.encode(data).replace(/[^a-z0-9!*+\-/=]/gi, chr => {
|
||||
let ord = chr.charCodeAt(0).toString(16).toUpperCase();
|
||||
const ord = chr.charCodeAt(0).toString(16).toUpperCase();
|
||||
if (chr === ' ') {
|
||||
return '_';
|
||||
} else {
|
||||
return '=' + (ord.length === 1 ? '0' + ord : ord);
|
||||
}
|
||||
return '=' + (ord.length === 1 ? '0' + ord : ord);
|
||||
});
|
||||
} else if (mimeWordEncoding === 'B') {
|
||||
encodedStr = typeof data === 'string' ? data : base64.encode(data);
|
||||
@@ -80,7 +75,7 @@ module.exports = {
|
||||
encodedStr = this.splitMimeEncodedString(encodedStr, maxLength).join('?= =?' + toCharset + '?' + mimeWordEncoding + '?');
|
||||
} else {
|
||||
// RFC2047 6.3 (2) states that encoded-word must include an integral number of characters, so no chopping unicode sequences
|
||||
let parts = [];
|
||||
const parts = [];
|
||||
let lpart = '';
|
||||
for (let i = 0, len = encodedStr.length; i < len; i++) {
|
||||
let chr = encodedStr.charAt(i);
|
||||
@@ -129,42 +124,38 @@ module.exports = {
|
||||
encodeWords(value, mimeWordEncoding, maxLength, encodeAll) {
|
||||
maxLength = maxLength || 0;
|
||||
|
||||
let encodedValue;
|
||||
|
||||
// find first word with a non-printable ascii or special symbol in it
|
||||
let firstMatch = value.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);
|
||||
const firstMatch = value.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);
|
||||
if (!firstMatch) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (encodeAll) {
|
||||
// if it is requested to encode everything or the string contains something that resebles encoded word, then encode everything
|
||||
|
||||
return this.encodeWord(value, mimeWordEncoding, maxLength);
|
||||
}
|
||||
|
||||
// find the last word with a non-printable ascii in it
|
||||
let lastMatch = value.match(/(["\u0080-\uFFFF][^\s]*)[^"\u0080-\uFFFF]*$/);
|
||||
const lastMatch = value.match(/(["\u0080-\uFFFF][^\s]*)[^"\u0080-\uFFFF]*$/);
|
||||
if (!lastMatch) {
|
||||
// should not happen
|
||||
return value;
|
||||
}
|
||||
|
||||
let startIndex =
|
||||
const startIndex =
|
||||
firstMatch.index +
|
||||
(
|
||||
firstMatch[0].match(/[^\s]/) || {
|
||||
index: 0
|
||||
}
|
||||
).index;
|
||||
let endIndex = lastMatch.index + (lastMatch[1] || '').length;
|
||||
const endIndex = lastMatch.index + (lastMatch[1] || '').length;
|
||||
|
||||
encodedValue =
|
||||
return (
|
||||
(startIndex ? value.substr(0, startIndex) : '') +
|
||||
this.encodeWord(value.substring(startIndex, endIndex), mimeWordEncoding || 'Q', maxLength) +
|
||||
(endIndex < value.length ? value.substr(endIndex) : '');
|
||||
|
||||
return encodedValue;
|
||||
(endIndex < value.length ? value.substr(endIndex) : '')
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -175,12 +166,12 @@ module.exports = {
|
||||
* @return {String} joined header value
|
||||
*/
|
||||
buildHeaderValue(structured) {
|
||||
let paramsArray = [];
|
||||
const paramsArray = [];
|
||||
|
||||
Object.keys(structured.params || {}).forEach(param => {
|
||||
// filename might include unicode characters so it is a special case
|
||||
// other values probably do not
|
||||
let value = structured.params[param];
|
||||
const value = structured.params[param];
|
||||
if (!this.isPlainText(value, true) || value.length >= 75) {
|
||||
this.buildHeaderParam(param, value, 50).forEach(encodedParam => {
|
||||
if (!/[\s"\\;:/=(),<>@[\]?]|^[-']|'$/.test(encodedParam.value) || encodedParam.key.substr(-1) === '*') {
|
||||
@@ -215,9 +206,8 @@ module.exports = {
|
||||
* @return {Array} A list of encoded keys and headers
|
||||
*/
|
||||
buildHeaderParam(key, data, maxLength) {
|
||||
let list = [];
|
||||
const list = [];
|
||||
let encodedStr = typeof data === 'string' ? data : (data || '').toString();
|
||||
let encodedStrArr;
|
||||
let chr, ord;
|
||||
let line;
|
||||
let startPos = 0;
|
||||
@@ -252,7 +242,7 @@ module.exports = {
|
||||
} else {
|
||||
if (/[\uD800-\uDBFF]/.test(encodedStr)) {
|
||||
// string containts surrogate pairs, so normalize it to an array of bytes
|
||||
encodedStrArr = [];
|
||||
const encodedStrArr = [];
|
||||
for (i = 0, len = encodedStr.length; i < len; i++) {
|
||||
chr = encodedStr.charAt(i);
|
||||
ord = chr.charCodeAt(0);
|
||||
@@ -356,7 +346,7 @@ module.exports = {
|
||||
* @return {Object} Header value as a parsed structure
|
||||
*/
|
||||
parseHeaderValue(str) {
|
||||
let response = {
|
||||
const response = {
|
||||
value: false,
|
||||
params: {}
|
||||
};
|
||||
@@ -458,12 +448,11 @@ module.exports = {
|
||||
value
|
||||
// fix invalidly encoded chars
|
||||
.replace(/[=?_\s]/g, s => {
|
||||
let c = s.charCodeAt(0).toString(16);
|
||||
const c = s.charCodeAt(0).toString(16);
|
||||
if (s === ' ') {
|
||||
return '_';
|
||||
} else {
|
||||
return '%' + (c.length < 2 ? '0' : '') + c;
|
||||
}
|
||||
return '%' + (c.length < 2 ? '0' : '') + c;
|
||||
})
|
||||
// change from urlencoding to percent encoding
|
||||
.replace(/%/g, '=') +
|
||||
@@ -508,11 +497,10 @@ module.exports = {
|
||||
str = (str || '').toString();
|
||||
lineLength = lineLength || 76;
|
||||
|
||||
let pos = 0,
|
||||
len = str.length,
|
||||
result = '',
|
||||
line,
|
||||
match;
|
||||
let pos = 0;
|
||||
const len = str.length;
|
||||
let result = '';
|
||||
let line, match;
|
||||
|
||||
while (pos < len) {
|
||||
line = str.substr(pos, lineLength);
|
||||
@@ -549,11 +537,8 @@ module.exports = {
|
||||
* @return {Array} Split string
|
||||
*/
|
||||
splitMimeEncodedString: (str, maxlen) => {
|
||||
let curLine,
|
||||
match,
|
||||
chr,
|
||||
done,
|
||||
lines = [];
|
||||
const lines = [];
|
||||
let curLine, match, chr, done;
|
||||
|
||||
// require at least 12 symbols to fit possible 4 octet UTF-8 sequences
|
||||
maxlen = Math.max(maxlen || 0, 12);
|
||||
|
||||
18
node_modules/nodemailer/lib/mime-funcs/mime-types.js
generated
vendored
18
node_modules/nodemailer/lib/mime-funcs/mime-types.js
generated
vendored
@@ -2073,13 +2073,9 @@ module.exports = {
|
||||
return defaultMimeType;
|
||||
}
|
||||
|
||||
let parsed = path.parse(filename);
|
||||
let extension = (parsed.ext.substr(1) || parsed.name || '').split('?').shift().trim().toLowerCase();
|
||||
let value = defaultMimeType;
|
||||
|
||||
if (extensions.has(extension)) {
|
||||
value = extensions.get(extension);
|
||||
}
|
||||
const parsed = path.parse(filename);
|
||||
const extension = (parsed.ext.substr(1) || parsed.name || '').split('?').shift().trim().toLowerCase();
|
||||
const value = extensions.has(extension) ? extensions.get(extension) : defaultMimeType;
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return value[0];
|
||||
@@ -2091,12 +2087,12 @@ module.exports = {
|
||||
if (!mimeType) {
|
||||
return defaultExtension;
|
||||
}
|
||||
let parts = (mimeType || '').toLowerCase().trim().split('/');
|
||||
let rootType = parts.shift().trim();
|
||||
let subType = parts.join('/').trim();
|
||||
const parts = (mimeType || '').toLowerCase().trim().split('/');
|
||||
const rootType = parts.shift().trim();
|
||||
const subType = parts.join('/').trim();
|
||||
|
||||
if (mimeTypes.has(rootType + '/' + subType)) {
|
||||
let value = mimeTypes.get(rootType + '/' + subType);
|
||||
const value = mimeTypes.get(rootType + '/' + subType);
|
||||
if (Array.isArray(value)) {
|
||||
return value[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user