Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions email_body_utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,15 @@ const EmailBodyUtility = function() {

// grab each of the available values
var bodytext = haraka_obj.bodytext;
var haraka_body_text_encoded = _formatQuotedPrintableBody(haraka_obj.body_text_encoded);

// haraka_obj.body_text_encoded is of type Buffer since 2.8.26 and of type String before this version
var _haraka_body_text_encoded = '';
if (haraka_obj.body_text_encoded instanceof Buffer) {
_haraka_body_text_encoded = haraka_obj.body_text_encoded.slice(0, haraka_obj.body_text_encoded_pos).toString('binary');
} else {
_haraka_body_text_encoded = haraka_obj.body_text_encoded;
}
var haraka_body_text_encoded = _formatQuotedPrintableBody(_haraka_body_text_encoded);

// set has_valid_encoding
has_valid_encoding = !!haraka_obj.body_encoding && !haraka_obj.body_encoding.includes('broken') && !!haraka_obj.bodytext;
Expand Down Expand Up @@ -713,4 +721,4 @@ const EmailBodyUtility = function() {
convertPlainTextToHtml // (text)
};
}();
module.exports = EmailBodyUtility;
module.exports = EmailBodyUtility;