Skip to content

Commit

Permalink
Merge pull request #29382 from nextcloud/techdebt/noid/500-on-OCS-aft…
Browse files Browse the repository at this point in the history
…er-internal-error
  • Loading branch information
juliusknorr authored Oct 22, 2021
2 parents 8b742ab + c160668 commit 3b06b47
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ocs/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@
OC_API::setContentType();

$format = \OC::$server->getRequest()->getParam('format', 'xml');
$txt = 'Invalid query, please check the syntax. API specifications are here:'
.' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n";
OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_NOT_FOUND, $txt), $format);
$txt = 'Internal Server Error'."\n";
try {
if (\OC::$server->getSystemConfig()->getValue('debug', false)) {
$txt .= $e->getMessage();
}
} catch (\Throwable $e) {
// Just to be save
}
OC_API::respond(new \OC\OCS\Result(null, \OCP\AppFramework\OCSController::RESPOND_SERVER_ERROR, $txt), $format);
}

0 comments on commit 3b06b47

Please sign in to comment.