You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"}
The text was updated successfully, but these errors were encountered:
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.
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
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"}
The text was updated successfully, but these errors were encountered: