API: Fix merging of responses. Return 400 error when no OAuth operation sent.

This commit is contained in:
Tom Needham 2012-08-03 15:20:01 +00:00
parent 6047a5fe51
commit 21f8646ffc
2 changed files with 7 additions and 7 deletions

View File

@ -107,16 +107,16 @@ class OC_API {
$numresponses = count($responses);
foreach($responses as $response){
if(is_int($response) && empty($finalresponse)){
$finalresponse = $response;
if(is_int($response['response']) && empty($finalresponse)){
$finalresponse = $response['response'];
continue;
}
if(is_array($response)){
if(is_array($response['response'])){
// Shipped apps win
if(OC_App::isShipped($response['app'])){
$finalresponse = array_merge_recursive($finalresponse, $response);
$finalresponse = array_merge_recursive($finalresponse, $response['response']);
} else {
$finalresponse = array_merge_recursive($response, $finalresponse);
$finalresponse = array_merge_recursive($response['response'], $finalresponse);
}
}
}

View File

@ -76,8 +76,8 @@ switch($operation){
}
break;
default:
// Something went wrong
header('Location: /');
// Something went wrong, we need an operation!
OC_Response::setStatus(400);
break;
}