summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search/Quicksearch.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-10-18 17:56:02 +0200
committerDave Lawrence <dlawrence@mozilla.com>2013-10-18 17:56:02 +0200
commit8918816c5be0d178d04e181e58a6a1f5f12996b5 (patch)
treeedaff602f62e6a316fc29c62d2fade8d85108f0a /Bugzilla/Search/Quicksearch.pm
parent6c94610a36860c288f0bf692ca111e4cf9052bb5 (diff)
downloadbugzilla-8918816c5be0d178d04e181e58a6a1f5f12996b5.tar.gz
bugzilla-8918816c5be0d178d04e181e58a6a1f5f12996b5.tar.xz
Bug 922684 - backport upstream bug 919852 to bmo/4.2 to allow quicksearch style bug searching in the webservice API
Diffstat (limited to 'Bugzilla/Search/Quicksearch.pm')
-rw-r--r--Bugzilla/Search/Quicksearch.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index bc25bb4c0..9c252d04f 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -308,7 +308,7 @@ sub _bug_numbers_only {
# Allow separation by comma or whitespace.
$searchstring =~ s/[,\s]+/,/g;
- if ($searchstring !~ /,/) {
+ if ($searchstring !~ /,/ && !i_am_webservice()) {
# Single bug number; shortcut to show_bug.cgi.
print $cgi->redirect(
-uri => correct_urlbase() . "show_bug.cgi?id=$searchstring");
@@ -327,9 +327,11 @@ sub _handle_alias {
if ($searchstring =~ /^([^,\s]+)$/) {
my $alias = $1;
# We use this direct SQL because we want quicksearch to be VERY fast.
- my $is_alias = Bugzilla->dbh->selectrow_array(
- q{SELECT 1 FROM bugs WHERE alias = ?}, undef, $alias);
- if ($is_alias) {
+ my $bug_id = Bugzilla->dbh->selectrow_array(
+ q{SELECT bug_id FROM bugs WHERE alias = ?}, undef, $alias);
+ # If the user cannot see the bug or if we are using a webservice,
+ # do not resolve its alias.
+ if ($bug_id && Bugzilla->user->can_see_bug($bug_id) && !i_am_webservice()) {
$alias = url_quote($alias);
print Bugzilla->cgi->redirect(
-uri => correct_urlbase() . "show_bug.cgi?id=$alias");