node_modules: update

This commit is contained in:
Dawid Dziurla
2020-07-09 15:48:05 +02:00
parent 80f113f0ef
commit 73116f5945
14 changed files with 164 additions and 99 deletions

View File

@ -100,12 +100,7 @@ class MailComposer {
if (attachment.filename) {
data.filename = attachment.filename;
} else if (!isMessageNode && attachment.filename !== false) {
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);
}
@ -207,7 +202,7 @@ class MailComposer {
content: this.mail.text
};
}
text.contentType = 'text/plain' + (!text.encoding && mimeFuncs.isPlainText(text.content) ? '' : '; charset=utf-8');
text.contentType = 'text/plain; charset=utf-8';
}
if (this.mail.watchHtml) {
@ -221,7 +216,7 @@ class MailComposer {
content: this.mail.watchHtml
};
}
watchHtml.contentType = 'text/watch-html' + (!watchHtml.encoding && mimeFuncs.isPlainText(watchHtml.content) ? '' : '; charset=utf-8');
watchHtml.contentType = 'text/watch-html; charset=utf-8';
}
if (this.mail.amp) {
@ -232,7 +227,7 @@ class MailComposer {
content: this.mail.amp
};
}
amp.contentType = 'text/x-amp-html' + (!amp.encoding && mimeFuncs.isPlainText(amp.content) ? '' : '; charset=utf-8');
amp.contentType = 'text/x-amp-html; charset=utf-8';
}
// only include the calendar alternative if there are no attachments
@ -261,12 +256,7 @@ class MailComposer {
}
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 = {};
}
@ -280,7 +270,7 @@ class MailComposer {
content: this.mail.html
};
}
html.contentType = 'text/html' + (!html.encoding && mimeFuncs.isPlainText(html.content) ? '' : '; charset=utf-8');
html.contentType = 'text/html; charset=utf-8';
}
[]

View File

@ -80,11 +80,7 @@ class MimeNode {
/**
* Indicates which encoding should be used for header strings: "Q" or "B"
*/
this.textEncoding = (options.textEncoding || '')
.toString()
.trim()
.charAt(0)
.toUpperCase();
this.textEncoding = (options.textEncoding || '').toString().trim().charAt(0).toUpperCase();
/**
* Immediate parent for this node (or undefined if not set)
@ -441,16 +437,10 @@ class MimeNode {
getTransferEncoding() {
let transferEncoding = false;
let contentType = (this.getHeader('Content-Type') || '')
.toString()
.toLowerCase()
.trim();
let contentType = (this.getHeader('Content-Type') || '').toString().toLowerCase().trim();
if (this.content) {
transferEncoding = (this.getHeader('Content-Transfer-Encoding') || '')
.toString()
.toLowerCase()
.trim();
transferEncoding = (this.getHeader('Content-Transfer-Encoding') || '').toString().toLowerCase().trim();
if (!transferEncoding || !['base64', 'quoted-printable'].includes(transferEncoding)) {
if (/^text\//i.test(contentType)) {
// If there are no special symbols, no need to modify the text
@ -1023,7 +1013,7 @@ class MimeNode {
_handleContentType(structured) {
this.contentType = structured.value.trim().toLowerCase();
this.multipart = this.contentType.split('/').reduce((prev, value) => (prev === 'multipart' ? value : false));
this.multipart = /^multipart\//i.test(this.contentType) ? this.contentType.substr(this.contentType.indexOf('/') + 1) : false;
if (this.multipart) {
this.boundary = structured.params.boundary = structured.params.boundary || this.boundary || this._generateBoundary();

View File

@ -163,7 +163,12 @@ class XOAuth2 extends Stream {
iat,
exp: iat + this.options.serviceRequestTimeout
};
let token = this.jwtSignRS256(tokenData);
let token;
try {
token = this.jwtSignRS256(tokenData);
} catch (err) {
return callback(new Error('Can\x27t generate token. Check your auth options'));
}
urlOptions = {
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
@ -355,10 +360,7 @@ class XOAuth2 extends Stream {
*/
jwtSignRS256(payload) {
payload = ['{"alg":"RS256","typ":"JWT"}', JSON.stringify(payload)].map(val => this.toBase64URL(val)).join('.');
let signature = crypto
.createSign('RSA-SHA256')
.update(payload)
.sign(this.options.privateKey);
let signature = crypto.createSign('RSA-SHA256').update(payload).sign(this.options.privateKey);
return payload + '.' + this.toBase64URL(signature);
}
}