sendgrid-nodejs icon indicating copy to clipboard operation
sendgrid-nodejs copied to clipboard

Attachment filename gets appended with a random number

Open kmarrip opened this issue 2 years ago • 0 comments

Issue Summary

Sending an attachment messes up the filename the user finally gets to see.

Steps to Reproduce

  1. Add the code as below
  2. Send the attachment via code

Code Snippet

if (message.guideAttachment) {
    const guideAttachment = await getFileFromBlobStorage(
      message.guideAttachment.fileName
    );
    const emailGuideAttachment = {
      content: guideAttachment,
      filename: "Welcome_to_DL78.pdf",
      type: message.guideAttachment.type as FileTypes,
      disposition: 'attachment',
    };
    if (!email.attachments) email.attachments = [emailGuideAttachment];
    else email.attachments.push(emailGuideAttachment);
  }
  console.log(email);
  await sgMail.send(email);
}

Exception/Log

image The attachment filename is appended with random looking number [98] other times I get [58]

Technical details:

  • sendgrid-nodejs version: "^7.4.5"
  • node version: v14.16.0

kmarrip avatar Apr 20 '22 11:04 kmarrip