mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-08-29 08:54:06 +07:00
node_modules: upgrade
This commit is contained in:
31
node_modules/nodemailer/lib/mail-composer/index.js
generated
vendored
31
node_modules/nodemailer/lib/mail-composer/index.js
generated
vendored
@ -4,6 +4,7 @@
|
||||
|
||||
const MimeNode = require('../mime-node');
|
||||
const mimeFuncs = require('../mime-funcs');
|
||||
const parseDataURI = require('../shared').parseDataURI;
|
||||
|
||||
/**
|
||||
* Creates the object for composing a MimeNode instance out from the mail options
|
||||
@ -91,9 +92,13 @@ class MailComposer {
|
||||
attachment = this._processDataUrl(attachment);
|
||||
}
|
||||
|
||||
let contentType = attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin');
|
||||
let isImage = /^image\//i.test(contentType);
|
||||
let contentDisposition = attachment.contentDisposition || (isMessageNode || (isImage && attachment.cid) ? 'inline' : 'attachment');
|
||||
|
||||
data = {
|
||||
contentType: attachment.contentType || mimeFuncs.detectMimeType(attachment.filename || attachment.path || attachment.href || 'bin'),
|
||||
contentDisposition: attachment.contentDisposition || (isMessageNode ? 'inline' : 'attachment'),
|
||||
contentType,
|
||||
contentDisposition,
|
||||
contentTransferEncoding: 'contentTransferEncoding' in attachment ? attachment.contentTransferEncoding : 'base64'
|
||||
};
|
||||
|
||||
@ -506,7 +511,10 @@ class MailComposer {
|
||||
}
|
||||
|
||||
if (!/^text\//i.test(element.contentType) || element.contentDisposition) {
|
||||
node.setHeader('Content-Disposition', element.contentDisposition || (element.cid ? 'inline' : 'attachment'));
|
||||
node.setHeader(
|
||||
'Content-Disposition',
|
||||
element.contentDisposition || (element.cid && /^image\//i.test(element.contentType) ? 'inline' : 'attachment')
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof element.content === 'string' && !['utf8', 'usascii', 'ascii'].includes(encoding)) {
|
||||
@ -530,12 +538,17 @@ class MailComposer {
|
||||
* @return {Object} Parsed element
|
||||
*/
|
||||
_processDataUrl(element) {
|
||||
let parts = (element.path || element.href).match(/^data:((?:[^;]*;)*(?:[^,]*)),(.*)$/i);
|
||||
if (!parts) {
|
||||
let parsedDataUri;
|
||||
if ((element.path || element.href).match(/^data:/)) {
|
||||
parsedDataUri = parseDataURI(element.path || element.href);
|
||||
}
|
||||
|
||||
if (!parsedDataUri) {
|
||||
return element;
|
||||
}
|
||||
|
||||
element.content = /\bbase64$/i.test(parts[1]) ? Buffer.from(parts[2], 'base64') : Buffer.from(decodeURIComponent(parts[2]));
|
||||
element.content = parsedDataUri.data;
|
||||
element.contentType = element.contentType || parsedDataUri.contentType;
|
||||
|
||||
if ('path' in element) {
|
||||
element.path = false;
|
||||
@ -545,12 +558,6 @@ class MailComposer {
|
||||
element.href = false;
|
||||
}
|
||||
|
||||
parts[1].split(';').forEach(item => {
|
||||
if (/^\w+\/[^/]+$/i.test(item)) {
|
||||
element.contentType = element.contentType || item.toLowerCase();
|
||||
}
|
||||
});
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user