From 5f6997f6fe0955e650625a769195e1e896a9f04e Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Thu, 27 Oct 2022 14:15:56 +0200 Subject: [PATCH 1/2] Add an hint about reasons why files can't be accessed Hopefully saves some debugging time next time Signed-off-by: Carl Schwan --- apps/dav/lib/Connector/Sabre/Directory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index b575a051b2a..bffe99449cb 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -255,7 +255,11 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol if (!$this->info->isReadable()) { // return 403 instead of 404 because a 404 would make // the caller believe that the collection itself does not exist - throw new Forbidden('No read permissions'); + if (\OC_App::isEnabled('files_accesscontrol')) { + throw new Forbidden('No read permissions. This might be caused by files_accesscontrol, check your configured rules'); + } else { + throw new Forbidden('No read permissions'); + } } $folderContent = $this->getNode()->getDirectoryListing(); } catch (LockedException $e) { From 48ea9e1c23b6cd869ef720541cca25a046176e2f Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 23 Nov 2022 17:04:22 +0100 Subject: [PATCH 2/2] Use public IAppManager instead of OC_App Signed-off-by: Carl Schwan --- apps/dav/lib/Connector/Sabre/Directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index bffe99449cb..f4b1ee62190 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -255,7 +255,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol if (!$this->info->isReadable()) { // return 403 instead of 404 because a 404 would make // the caller believe that the collection itself does not exist - if (\OC_App::isEnabled('files_accesscontrol')) { + if (\OCP\Server::get(\OCP\App\IAppManager::class)->isInstalled('files_accesscontrol')) { throw new Forbidden('No read permissions. This might be caused by files_accesscontrol, check your configured rules'); } else { throw new Forbidden('No read permissions');