mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-23 06:55:45 +07:00
node_modules: update (#352)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
4026a70a6b
commit
47af4a10b5
53 files changed
+630
-217
No files matched your search
+42
-9
@@ -16,6 +16,40 @@ function isContentObject(value) {
|
||||
const content = value;
|
||||
return typeof value === 'object' && !!(content.content || content.path || content.href || content.raw);
|
||||
}
|
||||
/**
|
||||
* Tells whether attachment content is a string or a Buffer that 7bit can describe: ASCII
|
||||
* only, no NUL and no line over the 998 octets of RFC 5322. Anything else, a stream or a
|
||||
* file path included, can not be checked here
|
||||
*/
|
||||
function fitsSevenBit(content) {
|
||||
let at;
|
||||
let length;
|
||||
if (typeof content === 'string') {
|
||||
at = i => content.charCodeAt(i);
|
||||
length = content.length;
|
||||
}
|
||||
else if (Buffer.isBuffer(content)) {
|
||||
at = i => content[i];
|
||||
length = content.length;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
let lineLength = 0;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const c = at(i);
|
||||
if (c === 0 || c > 0x7f) {
|
||||
return false;
|
||||
}
|
||||
if (c === 0x0a || c === 0x0d) {
|
||||
lineLength = 0;
|
||||
}
|
||||
else if (++lineLength > 998) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
class MailComposer {
|
||||
constructor(mail) {
|
||||
this.mail = mail || {};
|
||||
@@ -98,8 +132,11 @@ class MailComposer {
|
||||
contentTransferEncoding = attachment.contentTransferEncoding;
|
||||
}
|
||||
else if (isMessageNode) {
|
||||
// the content might include non-ASCII bytes but at this point we do not know it yet
|
||||
contentTransferEncoding = '8bit';
|
||||
// a message/* part can not be encoded (RFC 2046 5.2.1), so the label has to describe
|
||||
// the content as it is. A stream or a file might hold non-ASCII bytes that can not be
|
||||
// checked here, so only content at hand that fits 7bit is labelled as such
|
||||
// content with an `encoding` is decoded later, so what it decodes to is not known here either
|
||||
contentTransferEncoding = !attachment.encoding && fitsSevenBit(attachment.content) ? '7bit' : '8bit';
|
||||
}
|
||||
else {
|
||||
contentTransferEncoding = 'base64'; // the default
|
||||
@@ -114,9 +151,7 @@ class MailComposer {
|
||||
}
|
||||
else if (!isMessageNode && attachment.filename !== false) {
|
||||
// a backslash separates as well, so a Windows path does not put the sender's directories in the headers
|
||||
data.filename =
|
||||
(attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() ||
|
||||
'attachment-' + (i + 1);
|
||||
data.filename = (attachment.path || attachment.href || '').split(/[/\\]/).pop().split('?').shift() || 'attachment-' + (i + 1);
|
||||
if (data.filename.indexOf('.') < 0) {
|
||||
data.filename += '.' + mimeFuncs.detectExtension(data.contentType);
|
||||
}
|
||||
@@ -277,8 +312,7 @@ class MailComposer {
|
||||
if (this.mail.icalEvent) {
|
||||
eventObject = Object.assign({}, this._getIcalEvent());
|
||||
eventObject.filename = false;
|
||||
eventObject.contentType =
|
||||
'text/calendar; charset=utf-8; method=' + (eventObject.method || 'PUBLISH').toString().trim().toUpperCase();
|
||||
eventObject.contentType = 'text/calendar; charset=utf-8; method=' + (eventObject.method || 'PUBLISH').toString().trim().toUpperCase();
|
||||
if (!eventObject.headers) {
|
||||
eventObject.headers = {};
|
||||
}
|
||||
@@ -306,8 +340,7 @@ class MailComposer {
|
||||
alternative = this._processDataUrl(alternative);
|
||||
}
|
||||
const data = {
|
||||
contentType: alternative.contentType ||
|
||||
mimeFuncs.detectMimeType(alternative.filename || alternative.path || alternative.href || 'txt'),
|
||||
contentType: alternative.contentType || mimeFuncs.detectMimeType(alternative.filename || alternative.path || alternative.href || 'txt'),
|
||||
contentTransferEncoding: alternative.contentTransferEncoding
|
||||
};
|
||||
if (alternative.filename) {
|
||||
|
||||
Reference in new issue
Block a user