From e3642f2f3dd9a60893f4c130276968288a72fbac Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 22 Oct 2015 17:04:36 +0200 Subject: [PATCH] handle NoUserException in sharing code * setup LDAP users * share from an LDAP user * delete that LDAP user * log in as share recipient * before: unhandled NoUserException * after: NoUserEception is logged and share is not shown anymore --- apps/files_sharing/lib/cache.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index a5d6474dc3c3..b8ef29e3436f 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -31,6 +31,7 @@ namespace OC\Files\Cache; +use OC\User\NoUserException; use OCP\Share_Backend_Collection; /** @@ -62,7 +63,12 @@ private function getSourceCache($target) { } $source = \OC_Share_Backend_File::getSource($target, $this->storage->getShare()); if (isset($source['path']) && isset($source['fileOwner'])) { - \OC\Files\Filesystem::initMountPoints($source['fileOwner']); + try { + \OC\Files\Filesystem::initMountPoints($source['fileOwner']); + } catch(NoUserException $e) { + \OC::$server->getLogger()->logException($e, ['app' => 'files_sharing']); + return false; + } $mounts = \OC\Files\Filesystem::getMountByNumericId($source['storage']); if (is_array($mounts) and !empty($mounts)) { $fullPath = $mounts[0]->getMountPoint() . $source['path'];