From 7ebe7f853a75a43073adf025bd2ce86e67ee6b91 Mon Sep 17 00:00:00 2001 From: Shaun Mc <29836851+shaunmccance@users.noreply.github.com> Date: Tue, 17 Apr 2018 08:53:36 +0100 Subject: [PATCH] Stop accumulation of subjectPrefix strings Conditional statement added to subjectPrefix section to stop accumulation of prefix strings on successive replies via same email route --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ead0495..8cefb91 100644 --- a/index.js +++ b/index.js @@ -220,7 +220,9 @@ exports.processMessage = function(data) { header = header.replace( /^Subject: (.*)/mg, function(match, subject) { - return 'Subject: ' + data.config.subjectPrefix + subject; + if (subject.indexOf(data.config.subjectPrefix) < 0) + return 'Subject: ' + data.config.subjectPrefix + subject; + else return 'Subject: ' + subject; }); }