From d4a51447d1b6858f2e8dae12cb2d38c2e2fa5e6b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 17 Jul 2018 17:28:02 +0200 Subject: Fix getting ocs share permissions if a storage is not available Signed-off-by: Robin Appelman --- apps/dav/lib/Connector/Sabre/Node.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'apps/dav/lib') diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php index 9e78d21a39d..38d0ff57fb2 100644 --- a/apps/dav/lib/Connector/Sabre/Node.php +++ b/apps/dav/lib/Connector/Sabre/Node.php @@ -38,6 +38,7 @@ use OC\Files\Mount\MoveableMount; use OC\Files\View; use OCA\DAV\Connector\Sabre\Exception\InvalidPath; use OCP\Files\FileInfo; +use OCP\Files\StorageNotAvailableException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; @@ -250,15 +251,17 @@ abstract class Node implements \Sabre\DAV\INode { } } - $storage = $this->info->getStorage(); - - $path = $this->info->getInternalPath(); + try { + $storage = $this->info->getStorage(); + } catch (StorageNotAvailableException $e) { + $storage = null; + } - if ($storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { + if ($storage && $storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage')) { /** @var \OCA\Files_Sharing\SharedStorage $storage */ $permissions = (int)$storage->getShare()->getPermissions(); } else { - $permissions = $storage->getPermissions($path); + $permissions = $this->info->getPermissions(); } /* -- cgit v1.2.3