Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getErrorAttachments(report) {
console.log(`Get error attachments for report with id: ${report.id}'`);
return [
ErrorAttachmentLog.attachmentWithText('hello', 'hello.txt'),
ErrorAttachmentLog.attachmentWithBinary(testIcon, 'icon.png', 'image/png')
];
},
return (async () => {
const [textAttachment, binaryAttachment, binaryName, binaryType] = await Promise.all([
AttachmentsProvider.getTextAttachment(),
AttachmentsProvider.getBinaryAttachment(),
AttachmentsProvider.getBinaryName(),
AttachmentsProvider.getBinaryType(),
]);
return [ErrorAttachmentLog.attachmentWithText(textAttachment, 'hello.txt'),
ErrorAttachmentLog.attachmentWithBinary(binaryAttachment, binaryName, binaryType)];
})();
},
return (async () => {
const [
textAttachment,
binaryAttachment,
binaryName,
binaryType
] = await Promise.all([
AttachmentsProvider.getTextAttachment(),
AttachmentsProvider.getBinaryAttachment(),
AttachmentsProvider.getBinaryName(),
AttachmentsProvider.getBinaryType()
]);
//TODO type of binary attachment is always string?
return [
ErrorAttachmentLog.attachmentWithText(textAttachment, "hello.txt"),
ErrorAttachmentLog.attachmentWithBinary(
binaryAttachment,
binaryName,
binaryType
)
];
})();
},
return (async () => {
const attachments = [];
const [textAttachment, binaryAttachment, binaryName, binaryType] = await Promise.all([
AttachmentsProvider.getTextAttachment(),
AttachmentsProvider.getBinaryAttachment(),
AttachmentsProvider.getBinaryName(),
AttachmentsProvider.getBinaryType(),
]);
if (textAttachment !== null) {
attachments.push(ErrorAttachmentLog.attachmentWithText(textAttachment, 'hello.txt'));
}
if (binaryAttachment !== null && binaryName !== null && binaryType !== null) {
attachments.push(ErrorAttachmentLog.attachmentWithBinary(binaryAttachment, binaryName, binaryType));
}
return attachments;
})();
},
return (async () => {
const attachments = [];
const [textAttachment, binaryAttachment, binaryName, binaryType] = await Promise.all([
AttachmentsProvider.getTextAttachment(),
AttachmentsProvider.getBinaryAttachment(),
AttachmentsProvider.getBinaryName(),
AttachmentsProvider.getBinaryType(),
]);
if (textAttachment !== null) {
attachments.push(ErrorAttachmentLog.attachmentWithText(textAttachment, 'hello.txt'));
}
if (binaryAttachment !== null && binaryName !== null && binaryType !== null) {
attachments.push(ErrorAttachmentLog.attachmentWithBinary(binaryAttachment, binaryName, binaryType));
}
return attachments;
})();
},