diff options
author | Byron Jones <bjones@mozilla.com> | 2012-08-28 08:29:40 +0200 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-08-28 08:29:40 +0200 |
commit | 2def70a01bd470f46fa8b83a71e1ec59b7089093 (patch) | |
tree | 584b9f35e8b23d99a7e7470766082746dedc8f05 /extensions/SecureMail | |
parent | 07ce1e486b11e2ef29783a40312677f3db98c143 (diff) | |
download | bugzilla-2def70a01bd470f46fa8b83a71e1ec59b7089093.tar.gz bugzilla-2def70a01bd470f46fa8b83a71e1ec59b7089093.tar.xz |
Bug 786167: fix various "use of uninitialized value" warnings
Diffstat (limited to 'extensions/SecureMail')
-rw-r--r-- | extensions/SecureMail/Extension.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/extensions/SecureMail/Extension.pm b/extensions/SecureMail/Extension.pm index 28da64358..3421d01c6 100644 --- a/extensions/SecureMail/Extension.pm +++ b/extensions/SecureMail/Extension.pm @@ -261,7 +261,9 @@ sub mailer_before_send { } } # Encrypt if updating a private attachment without a comment - if ($email->header('X-Bugzilla-Changed-Fields') =~ /Attachment #(\d+)/) { + if ($email->header('X-Bugzilla-Changed-Fields') + && $email->header('X-Bugzilla-Changed-Fields') =~ /Attachment #(\d+)/) + { my $attachment = Bugzilla::Attachment->new($1); if ($attachment && $attachment->isprivate) { $make_secure = SECURE_BODY; @@ -532,10 +534,12 @@ sub _filter_bug_links { my ($email) = @_; $email->walk_parts(sub { my $part = shift; - return if $part->content_type !~ /text\/html/; + my $content_type = $part->content_type; + return if !$content_type || $content_type !~ /text\/html/; my $body = $part->body; my $tree = HTML::Tree->new->parse_content($body); my @links = $tree->look_down( _tag => q{a}, class => qr/bz_bug_link/ ); + my $updated = 0; foreach my $link (@links) { my $href = $link->attr('href'); my ($bug_id) = $href =~ /\Qshow_bug.cgi?id=\E(\d+)/; @@ -543,12 +547,15 @@ sub _filter_bug_links { if ($bug && _should_secure_bug($bug)) { $link->attr('title', '(secure bug)'); $link->attr('class', 'bz_bug_link'); + $updated = 1; } } - $body = $tree->as_HTML; - $part->body_set($body); - $part->charset_set('UTF-8') if Bugzilla->params->{'utf8'}; - $part->encoding_set('quoted-printable'); + if ($updated) { + $body = $tree->as_HTML; + $part->body_set($body); + $part->charset_set('UTF-8') if Bugzilla->params->{'utf8'}; + $part->encoding_set('quoted-printable'); + } }); } |