Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to display e-mail attachment (.csv file) in mailslurper #6

Closed
gerick11 opened this issue Aug 13, 2015 · 3 comments
Closed

Unable to display e-mail attachment (.csv file) in mailslurper #6

gerick11 opened this issue Aug 13, 2015 · 3 comments
Assignees
Labels

Comments

@gerick11
Copy link

When attempting to view an attachment to an email in MailSlurper, the attachment won't open and the following is displayed:
{"success":false,"message":"Cannot decode attachment"}

@adampresley
Copy link
Contributor

So I created a test with a basic CSV file (see attachment below) and sent it as a type text/csv attachment and everything went through fine. Can you perhaps attach a sample or describe what might be special about the CSV or mail sending process? Please ensure there is no divulge any sensitive personal or corporate information.

screen shot 2015-08-15 at 7 19 57 pm

@adampresley adampresley self-assigned this Aug 16, 2015
@adampresley
Copy link
Contributor

Ok, after investigating the issue with you I see the following issues that I will work to correct.

  • The content type of this CSV attachment was application/octet-stream. This is a problem with the sender, but should not necessarily be a show stopper for MailSlurper
  • The attachment controller in the service is attempting to Base64 decode the attachment, regardless of if the attachment is actually base64 encoded or not. This is a bug in MailSlurper

I will work to address this bug. For the base64 encoding question, since I cannot rely on the content type, I will use the following to determine if I should attempt a decode or not.

  • Check if the content length is a multple of 4 (length % 4 == 0)
  • Validate against a regex like this for base64 allowed characters: ^[A-Za-z0-9+/=]+\Z

@gerick11
Copy link
Author

Thank you so much for the prompt response and resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants