From 5cbb1c79abf94ffdd55f554c910da64cd9782503 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 22 Dec 2011 00:21:47 +0800 Subject: Bug 712327: fix issue in FlagTypeComment when editing flags --- extensions/FlagTypeComment/Extension.pm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'extensions/FlagTypeComment') diff --git a/extensions/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm index 4c1b5cc05..4b5ef5510 100644 --- a/extensions/FlagTypeComment/Extension.pm +++ b/extensions/FlagTypeComment/Extension.pm @@ -22,11 +22,12 @@ package Bugzilla::Extension::FlagTypeComment; use strict; use base qw(Bugzilla::Extension); -use Bugzilla::FlagType; -use Bugzilla::Util 'trick_taint'; - use Bugzilla::Extension::FlagTypeComment::Constants; +use Bugzilla::FlagType; +use Bugzilla::Util qw(trick_taint); +use Scalar::Util qw(blessed); + our $VERSION = '1'; ################ @@ -83,7 +84,14 @@ sub _set_ftc_states { if ($file =~ /^admin\//) { # admin my $type = $vars->{'type'} || return; - if ($type->target_type eq 'bug') { + my ($target_type, $id); + if (blessed($type)) { + ($target_type, $id) = ($type->target_type, $type->id); + } else { + ($target_type, $id) = ($type->{target_type}, $type->{id}); + trick_taint($id); + } + if ($target_type eq 'bug') { return unless FLAGTYPE_COMMENT_BUG_FLAGS; } else { return unless FLAGTYPE_COMMENT_ATTACHMENT_FLAGS; @@ -93,7 +101,7 @@ sub _set_ftc_states { FROM flagtype_comments WHERE type_id=?", 'state', undef, - $type->id); + $id); } else { # creating/editing attachment / viewing bug -- cgit v1.2.3-24-g4f1b