From c1ab894b59924df3cb1e2c82e5553f31d799a375 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Mon, 26 Feb 2024 16:57:30 +0100 Subject: [PATCH] fix(dav): Init ViewOnlyPlugin after auth Signed-off-by: Louis Chemineau --- apps/dav/lib/Server.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index e10dc41aeb43d..e87008a2bb72a 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -239,11 +239,6 @@ public function __construct(IRequest $request, string $baseUri) { $this->server->addPlugin(new FakeLockerPlugin()); } - // Allow view-only plugin for webdav requests - $this->server->addPlugin(new ViewOnlyPlugin( - \OC::$server->getUserFolder(), - )); - if (BrowserErrorPagePlugin::isBrowserRequest($request)) { $this->server->addPlugin(new BrowserErrorPagePlugin()); } @@ -253,6 +248,11 @@ public function __construct(IRequest $request, string $baseUri) { // wait with registering these until auth is handled and the filesystem is setup $this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend, $logger) { + // Allow view-only plugin for webdav requests + $this->server->addPlugin(new ViewOnlyPlugin( + \OC::$server->getUserFolder(), + )); + // custom properties plugin must be the last one $userSession = \OC::$server->getUserSession(); $user = $userSession->getUser();