From aaf0b7ffcf111d550c3442e5213045d5a20243ef Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Mon, 23 Nov 2020 17:34:46 -0800 Subject: [PATCH] Clean-up header dumps of non-RFC822 messages. If there's no 'id' property, don't display "Message-ID: undefined". If the new default_content_type argument is false, don't display a default content-type and content-transfer-encoding. --- exec/load/822header.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exec/load/822header.js b/exec/load/822header.js index 8022352e43..83fbecd787 100644 --- a/exec/load/822header.js +++ b/exec/load/822header.js @@ -3,7 +3,7 @@ require("utf8_ascii.js", 'utf8_ascii'); require("smbdefs.js", 'RFC822HEADER'); -MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold) +MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold, default_content_type) { var content_type; var i; @@ -17,7 +17,8 @@ MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold) if(this.cc_list) this.rfc822 += "Cc: " + this.cc_list + "\r\n"; this.rfc822 += "Subject: "+this.subject+"\r\n"; - this.rfc822 += "Message-ID: "+this.id+"\r\n"; + if(this.id) + this.rfc822 += "Message-ID: "+this.id+"\r\n"; this.rfc822 += "Date: "+this.date+"\r\n"; var quoted_from = '"' + this.from + '"'; @@ -105,7 +106,7 @@ MsgBase.HeaderPrototype.get_rfc822_header=function(force_update, unfold) this.rfc822 += this.field_list[i].data+"\r\n"; } } - if(content_type==undefined) { + if(content_type==undefined && default_content_type !== false) { var charset = this.text_charset || (this.is_utf8 ? "UTF-8" : "IBM437"); this.rfc822 += "Content-Type: text/plain; charset=" + charset + "\r\n"; this.rfc822 += "Content-Transfer-Encoding: 8bit\r\n"; -- GitLab