From f2a900e04ce80e259930341167a3c4575ea76275 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 20 May 2015 12:19:03 +0200 Subject: [PATCH] Return 401 when accessing public webdav and s2s is disabled --- apps/files_sharing/publicwebdav.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php index c2a16e933b..b70274e6bc 100644 --- a/apps/files_sharing/publicwebdav.php +++ b/apps/files_sharing/publicwebdav.php @@ -24,10 +24,6 @@ * */ -if (OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled() === false) { - return false; -} - // load needed apps $RUNTIME_APPTYPES = array('filesystem', 'authentication', 'logging'); @@ -56,6 +52,11 @@ $server->addPlugin(new \OC\Connector\Sabre\ExceptionLoggerPlugin('webdav', \OC:: // wait with registering these until auth is handled and the filesystem is setup $server->on('beforeMethod', function () use ($server, $objectTree, $authBackend) { + if (OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled() === false) { + // this is what is thrown when trying to access a non-existing share + throw new \Sabre\DAV\Exception\NotAuthenticated(); + } + $share = $authBackend->getShare(); $rootShare = \OCP\Share::resolveReShare($share); $owner = $rootShare['uid_owner'];