From 2bf5ed2df1e4929b4c27ad8844932979d482fe26 Mon Sep 17 00:00:00 2001 From: David Lawrence Date: Fri, 9 Jan 2015 14:33:34 +0000 Subject: Bug 1118724: Private comments on public bugs are sent unencrypted by email --- extensions/SecureMail/Extension.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index a8299860c..582b9e127 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -318,6 +318,13 @@ sub mailer_before_send { "SELECT isprivate FROM longdescs WHERE bug_id=? ORDER BY bug_when", undef, $bug_id); # Encrypt if there are private comments on an otherwise public bug + if (scalar $email->parts > 1) { + $email->walk_parts(sub { + my $part = shift; + my $content_type = $part->content_type; + $body = $part->body if $content_type && $content_type =~ /^text\/plain/; + }); + } while ($body =~ /[\r\n]--- Comment #(\d+)/g) { my $comment_number = $1; if ($comment_number && $comment_is_private->[$comment_number]) { -- cgit v1.2.3-24-g4f1b