diff --git a/website/api/controllers/deliver-apple-csr.js b/website/api/controllers/deliver-apple-csr.js index 834b13dff8..238d8a97af 100644 --- a/website/api/controllers/deliver-apple-csr.js +++ b/website/api/controllers/deliver-apple-csr.js @@ -139,7 +139,11 @@ module.exports = { template: 'email-signed-csr-for-apns', templateData: {}, attachments: [{ - contentBytes: generateCertificateResult.request, + // When the file is provided as an attachment to the Sails helper, it + // gets decoded, since we need for the signed CSR to be delivered in + // base64 format, we doubly encode the contents before sending the + // email. + contentBytes: Buffer.from(generateCertificateResult.request).toString('base64'), name: 'apple-apns-request.txt', type: 'text/plain', }],