Support Article
Attachment is converted from 8-bit encoding to binary encoding
SA-59282
Summary
Setting the pyAttachFileNames property on pyRequestAttachmentPage, converts the content of the attachment from 8-bit encoding to binary encoding. As a result, the attachement displays as corrupted.
Error Messages
Not Applicable.
Steps to Reproduce
- Create a Connect-REST rule to send multi-part attachments
- Set the properties pyAttachNames, pyAttachValues, pyAttachTypes and pyAttachFileNames on the pyRequestAttachmentPage in the activity calling the Connect-REST rule
- Set the value of property pyAttachValues to JSON content and set the value of pyAttachTypes as 'application/json'
- Invoke the activity and capture the generated request content using the TCPMon utility. In this case the Content-Transfer-Encoding is set to binary even though JSON content is sent in multi-part attachments
- Test the same use case by removing the pyAttachFileNames property from pyRequestAttachmentPage. Without setting the pyAttachFileNames property, the Content-Transfer-Encoding is set to 8-bit for the JSON content sent in the multi-part attachment
Root Cause
An issue in the custom application code or rules.
The values that the application enters in the pyAttachValues property must be base64-encoded representations of the content for the Parts of the message, regardless of the content-type. Additionally, the application should populate the pyAttachTypes property in order to provide the Content-Type headers for the remote endpoint to use when interpreting the transmitted data. In this case, the value set for the pyAttachValues property was not base64-encoded content.
Resolution
Perform the following local-change:- Set the value for pyAttachValues property on the pyRequestAttachmentPage such that it is base64-encoded content
- Set the value for pyAttachTypes property such that the value is Content-Type (for example, application/json, text/plain) as expected by the remote endpoint for interpreting the multi-part message content
Published July 27, 2018 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.