From f8b984852ae27f14a5f44e651193f00977737ab1 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 26 May 2015 23:59:57 +0800 Subject: Bug 1146782: backport bug 1159589 to bmo (migrate autocomplete from yui to jquery) --- Bugzilla/WebService/User.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Bugzilla/WebService') diff --git a/Bugzilla/WebService/User.pm b/Bugzilla/WebService/User.pm index 8948a0195..8592d809c 100644 --- a/Bugzilla/WebService/User.pm +++ b/Bugzilla/WebService/User.pm @@ -27,7 +27,7 @@ use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Group; use Bugzilla::User; -use Bugzilla::Util qw(trim); +use Bugzilla::Util qw(trim detaint_natural); use Bugzilla::WebService::Util qw(filter filter_wants validate translate params_to_objects); use Bugzilla::Hook; @@ -207,11 +207,14 @@ sub get { userid => $obj->id}); } } - + # User Matching my $limit; - if ($params->{'maxusermatches'}) { - $limit = $params->{'maxusermatches'} + 1; + if ($params->{limit}) { + detaint_natural($params->{limit}) + || ThrowCodeError('param_must_be_numeric', + { function => 'User.match', param => 'limit' }); + $limit = $limit ? min($params->{limit}, $limit) : $params->{limit}; } my $exclude_disabled = $params->{'include_disabled'} ? 0 : 1; foreach my $match_string (@{ $params->{'match'} || [] }) { -- cgit v1.2.3-24-g4f1b