Skip to content

Commit 64fc523

Browse files
committed
Bug 1093600: Backout Bug 1088253 for breaking comment adding
1 parent 6ba0783 commit 64fc523

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

Bugzilla/WebService/Server/REST.pm

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -347,28 +347,11 @@ sub _retrieve_json_params {
347347
my $params = {};
348348
%{$params} = %{ Bugzilla->input_params };
349349

350-
# First add any parameters we were able to pull out of the path
351-
# based on the resource regexp and combine with the normal URL
352-
# parameters.
353-
if (my $rest_params = $self->bz_rest_params) {
354-
foreach my $param (keys %$rest_params) {
355-
if (!exists $params->{$param}) {
356-
$params->{$param} = $rest_params->{$param};
357-
next;
358-
}
359-
my @values = ref $rest_params->{$param}
360-
? @{ $rest_params->{$param} }
361-
: ($rest_params->{$param});
362-
if (ref $params->{$param}) {
363-
push(@{ $params->{$param} }, @values);
364-
}
365-
else {
366-
$params->{$param} = [ $params->{$param}, @values ];
367-
}
368-
}
369-
}
350+
# First add any params we were able to pull out of the path
351+
# based on the resource regexp
352+
%{$params} = (%{$params}, %{$self->bz_rest_params}) if $self->bz_rest_params;
370353

371-
# Merge any additional query key/values from the request body if non-GET.
354+
# Merge any additional query key/values with $obj->{params} if not a GET request
372355
# We do this manually cause CGI.pm doesn't understand JSON strings.
373356
if ($self->request->method ne 'GET') {
374357
my $extra_params = {};
@@ -379,6 +362,14 @@ sub _retrieve_json_params {
379362
ThrowUserError('json_rpc_invalid_params', { err_msg => $@ });
380363
}
381364
}
365+
366+
# Allow parameters in the query string if request was not GET.
367+
# Note: query string parameters will override any matching params
368+
# also specified in the request body.
369+
foreach my $param ($self->cgi->url_param()) {
370+
$extra_params->{$param} = $self->cgi->url_param($param);
371+
}
372+
382373
%{$params} = (%{$params}, %{$extra_params}) if %{$extra_params};
383374
}
384375

0 commit comments

Comments
 (0)