summaryrefslogtreecommitdiffstats
path: root/ocs
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2020-12-10 08:20:20 +0100
committerVincent Petry <vincent@nextcloud.com>2020-12-10 08:20:20 +0100
commit5f405e1454174074ac41bd279a44b3c4751880e0 (patch)
tree9ad784da736a4453af478ce4e76061d81b4458a7 /ocs
parentc8e0f3015f9c9d2f5c0b10ab7c13dd8e89cc87ff (diff)
downloadnextcloud-server-5f405e1454174074ac41bd279a44b3c4751880e0.tar.gz
nextcloud-server-5f405e1454174074ac41bd279a44b3c4751880e0.zip
Fix loading order for OCS endpoints
The loading order can have side effects in the way how apps register plugins, listeners, etc. Recently the order had been changed as part of cleaning up old code, but caused apps to break. This brings back the old app loading order to guarantee that apps won't break, even though it might not semantically make sense. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'ocs')
-rw-r--r--ocs/v1.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/ocs/v1.php b/ocs/v1.php
index e5138576584..3f165009f4b 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -51,13 +51,16 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException;
try {
OC_App::loadApps(['session']);
OC_App::loadApps(['authentication']);
- if (!\OC::$server->getUserSession()->isLoggedIn()) {
- OC::handleLogin(\OC::$server->getRequest());
- }
// load all apps to get all api routes properly setup
+ // FIXME: this should ideally appear after handleLogin but will cause
+ // side effects in existing apps
OC_App::loadApps();
+ if (!\OC::$server->getUserSession()->isLoggedIn()) {
+ OC::handleLogin(\OC::$server->getRequest());
+ }
+
OC::$server->get(\OC\Route\Router::class)->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo());
} catch (ResourceNotFoundException $e) {
OC_API::setContentType();