aboutsummaryrefslogtreecommitdiffstats
path: root/lib/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api.php')
-rw-r--r--lib/api.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/api.php b/lib/api.php
index 8d728d4311f..545b55757ff 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -90,10 +90,15 @@ class OC_API {
if(self::isAuthorised(self::$actions[$name])) {
if(is_callable(self::$actions[$name]['action'])) {
$response = call_user_func(self::$actions[$name]['action'], $parameters);
+ if(!($response instanceof OC_OCS_Result)) {
+ $response = new OC_OCS_Result(null, 996, 'Internal Server Error');
+ }
} else {
$response = new OC_OCS_Result(null, 998, 'Api method not found');
}
} else {
+ header('WWW-Authenticate: Basic realm="Authorization Required"');
+ header('HTTP/1.0 401 Unauthorized');
$response = new OC_OCS_Result(null, 997, 'Unauthorised');
}
// Send the response