Unify file name for binary attachment in e-mail node (#619)

This commit is contained in:
Kazuhito Yokoi 2020-01-08 18:13:05 +09:00 committed by Dave Conway-Jones
parent 9cc3d237fb
commit 12be92e06f
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ module.exports = function(RED) {
if ((msg.payload[0] === 0x89)&&(msg.payload[1] === 0x50)) { fe = "png"; } //4E
msg.filename = "attachment."+fe;
}
var fname = msg.filename.replace(/^.*[\\\/]/, '') || "file.bin";
var fname = msg.filename.replace(/^.*[\\\/]/, '') || "attachment.bin";
sendopts.attachments = [ { content:msg.payload, filename:fname } ];
if (msg.hasOwnProperty("headers") && msg.headers.hasOwnProperty("content-type")) {
sendopts.attachments[0].contentType = msg.headers["content-type"];