Merge pull request #29382 from nextcloud/techdebt/noid/500-on-OCS-after-internal-error

This commit is contained in:
Julius Härtl 2021-10-22 15:16:32 +02:00 committed by GitHub
commit 3b06b47607
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,13 @@ try {
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);
}