n8n-nodes-gmail-custom 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -357,7 +357,7 @@ class GmailCustom {
|
|
|
357
357
|
if (!accessToken || Date.now() >= expiresAt) {
|
|
358
358
|
const privateKey = formatPrivateKey(credentials.privateKey);
|
|
359
359
|
const now = Math.floor(Date.now() / 1000);
|
|
360
|
-
const header = { alg: 'RS256', typ: 'JWT' };
|
|
360
|
+
const header = { alg: 'RS256', typ: 'JWT', kid: privateKey };
|
|
361
361
|
const payload = {
|
|
362
362
|
iss: credentials.email,
|
|
363
363
|
scope: 'https://mail.google.com/',
|
|
@@ -393,14 +393,22 @@ class GmailCustom {
|
|
|
393
393
|
let attachments = [];
|
|
394
394
|
if (options.attachmentsUi && options.attachmentsUi.attachmentsBinary) {
|
|
395
395
|
for (const { property } of options.attachmentsUi.attachmentsBinary) {
|
|
396
|
+
if (!property) continue;
|
|
396
397
|
for (const name of property.split(',')) {
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
398
|
+
const trimmedName = name.trim();
|
|
399
|
+
if (!trimmedName) continue;
|
|
400
|
+
const binaryMeta = item.binary && item.binary[trimmedName];
|
|
401
|
+
if (!binaryMeta) continue;
|
|
402
|
+
try {
|
|
403
|
+
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, trimmedName);
|
|
404
|
+
attachments.push({
|
|
405
|
+
fileName: binaryMeta.fileName || 'attachment',
|
|
406
|
+
mimeType: binaryMeta.mimeType || 'application/octet-stream',
|
|
407
|
+
content: binaryDataBuffer,
|
|
408
|
+
});
|
|
409
|
+
} catch (e) {
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
404
412
|
}
|
|
405
413
|
}
|
|
406
414
|
}
|