mirror of https://github.com/nextcloud/server
Fix 404 handling of requested JSON/XML
If front-end or an application requests JSON/XML, there is no point in redirecting to the default page if that response doesn't exist. In the worst case that would just cause another request, therefore server load, traffic and a response that is meaningless to the requester. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
48ece9f345
commit
222a9523b5
|
@ -1048,6 +1048,13 @@ class OC {
|
|||
return;
|
||||
}
|
||||
|
||||
// Handle requests for JSON or XML
|
||||
$acceptHeader = $request->getHeader('Accept');
|
||||
if (in_array($acceptHeader, ['application/json', 'application/xml'], true)) {
|
||||
http_response_code(404);
|
||||
return;
|
||||
}
|
||||
|
||||
// Someone is logged in
|
||||
if (\OC::$server->getUserSession()->isLoggedIn()) {
|
||||
OC_App::loadApps();
|
||||
|
|
Loading…
Reference in New Issue