summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2014-12-05 23:46:59 +0100
committerDavid Lawrence <dkl@mozilla.com>2014-12-05 23:47:30 +0100
commit66da5aeeaf1b14f70864cc19940ca188e6341528 (patch)
tree2c82542e531c1a89be3a7e87ec3705b612466db9
parent57c99986924bfebb7ad044ec1753220d1ff243cc (diff)
downloadbugzilla-66da5aeeaf1b14f70864cc19940ca188e6341528.tar.gz
bugzilla-66da5aeeaf1b14f70864cc19940ca188e6341528.tar.xz
Bug 829358: Changing the name of a private attachment in an unhidden bug results in the name change being sent unencrypted
-rw-r--r--Bugzilla/BugMail.pm5
-rw-r--r--extensions/SecureMail/Extension.pm4
-rw-r--r--template/en/default/email/header-common.txt.tmpl3
3 files changed, 9 insertions, 3 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 6466448bc..7244d97a5 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -365,13 +365,14 @@ sub sendMail {
my $relRef = $params->{rels_which_want};
my $referenced_bugs = $params->{referenced_bugs};
my $dep_only = $params->{dep_only};
+ my $attach_id;
# Only display changes the user is allowed see.
my @display_diffs;
foreach my $diff (@diffs) {
my $add_diff = 0;
-
+
if (grep { $_ eq $diff->{field_name} } TIMETRACKING_FIELDS) {
$add_diff = 1 if $user->is_timetracker;
}
@@ -379,6 +380,7 @@ sub sendMail {
$add_diff = 1;
}
push(@display_diffs, $diff) if $add_diff;
+ $attach_id = $diff->{attach_id} if $diff->{attach_id};
}
if (!$user->is_insider) {
@@ -428,6 +430,7 @@ sub sendMail {
date => $date,
to_user => $user,
bug => $bug,
+ attach_id => $attach_id,
reasons => \@reasons,
reasons_watch => \@reasons_watch,
reasonsheader => join(" ", @headerrel),
diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm
index 90fafc06f..a8299860c 100644
--- a/extensions/SecureMail/Extension.pm
+++ b/extensions/SecureMail/Extension.pm
@@ -327,9 +327,9 @@ sub mailer_before_send {
}
# Encrypt if updating a private attachment without a comment
if ($email->header('X-Bugzilla-Changed-Fields')
- && $email->header('X-Bugzilla-Changed-Fields') =~ /Attachment #(\d+)/)
+ && $email->header('X-Bugzilla-Attach-ID'))
{
- my $attachment = Bugzilla::Attachment->new($1);
+ my $attachment = Bugzilla::Attachment->new($email->header('X-Bugzilla-Attach-ID'));
if ($attachment && $attachment->isprivate) {
$make_secure = SECURE_BODY;
}
diff --git a/template/en/default/email/header-common.txt.tmpl b/template/en/default/email/header-common.txt.tmpl
index 3f3b7d373..f7bc996d8 100644
--- a/template/en/default/email/header-common.txt.tmpl
+++ b/template/en/default/email/header-common.txt.tmpl
@@ -9,6 +9,9 @@
X-Bugzilla-Classification: [% bug.classification %]
[% END %]
X-Bugzilla-ID: [% bug.id %]
+[% IF attach_id %]
+X-Bugzilla-Attach-ID: [% attach_id %]
+[% END %]
X-Bugzilla-Product: [% bug.product %]
X-Bugzilla-Component: [% bug.component %]
X-Bugzilla-Version: [% bug.version %]