From c2acb47e4057131f79bf395da1f034ab2b6eb58f Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Tue, 13 May 2008 21:44:31 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20433514:=20Renaming=20a=20saved=20search?= =?UTF-8?q?=20with=20the=20same=20name=20of=20different=20case=20causes=20?= =?UTF-8?q?db=20error=20-=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9ric=20?= =?UTF-8?q?Buclin=20=20r/a=3Dmkanat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@251586 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm | 5 ++++- mozilla/webtools/bugzilla/buglist.cgi | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm b/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm index 3484eb3bce3..9aa27714d3f 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Search/Saved.pm @@ -55,7 +55,7 @@ use constant VALIDATORS => { link_in_footer => \&_check_link_in_footer, }; -use constant UPDATE_COLUMNS => qw(query query_type); +use constant UPDATE_COLUMNS => qw(name query query_type); ############## # Validators # @@ -79,6 +79,8 @@ sub _check_query { $query || ThrowUserError("buglist_parameters_required"); my $cgi = new Bugzilla::CGI($query); $cgi->clean_search_url; + # Don't store the query name as a parameter. + $cgi->delete('known_name'); return $cgi->query_string; } @@ -204,6 +206,7 @@ sub user { # Mutators # ############ +sub set_name { $_[0]->set('name', $_[1]); } sub set_url { $_[0]->set('query', $_[1]); } sub set_query_type { $_[0]->set('query_type', $_[1]); } diff --git a/mozilla/webtools/bugzilla/buglist.cgi b/mozilla/webtools/bugzilla/buglist.cgi index c40e65aed3e..0cf659c3dcf 100755 --- a/mozilla/webtools/bugzilla/buglist.cgi +++ b/mozilla/webtools/bugzilla/buglist.cgi @@ -298,9 +298,10 @@ sub InsertNamedQuery { my $dbh = Bugzilla->dbh; $query_name = trim($query_name); - my ($query_obj) = grep {$_->name eq $query_name} @{Bugzilla->user->queries}; + my ($query_obj) = grep {lc($_->name) eq lc($query_name)} @{Bugzilla->user->queries}; if ($query_obj) { + $query_obj->set_name($query_name); $query_obj->set_url($query); $query_obj->set_query_type($query_type); $query_obj->update();