[Pkg-owncloud-commits] [owncloud] 92/205: [sharing] handle shares of users that aren't available anymore

David Prévot taffit at moszumanska.debian.org
Thu Jul 2 17:36:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 4f2f8a6f288a523ec5f6deadd0bdfa04ec72cb9c
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Tue Jun 23 17:09:00 2015 +0200

    [sharing] handle shares of users that aren't available anymore
    
    * properly handle the case where an abandoned share is left and
      simply skip it
---
 apps/files_sharing/lib/mountprovider.php | 12 ++++++++++--
 lib/private/files/filesystem.php         |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/apps/files_sharing/lib/mountprovider.php b/apps/files_sharing/lib/mountprovider.php
index 94fb473..c5d3643 100644
--- a/apps/files_sharing/lib/mountprovider.php
+++ b/apps/files_sharing/lib/mountprovider.php
@@ -9,6 +9,7 @@
 namespace OCA\Files_Sharing;
 
 use OC\Files\Filesystem;
+use OC\User\NoUserException;
 use OCA\Files_Sharing\Propagation\PropagationManager;
 use OCP\Files\Config\IMountProvider;
 use OCP\Files\Storage\IStorageFactory;
@@ -50,8 +51,13 @@ class MountProvider implements IMountProvider {
 		$shares = array_filter($shares, function ($share) {
 			return $share['permissions'] > 0;
 		});
-		return array_map(function ($share) use ($user, $storageFactory) {
-			Filesystem::initMountPoints($share['uid_owner']);
+		$shares = array_map(function ($share) use ($user, $storageFactory) {
+			try {
+				Filesystem::initMountPoints($share['uid_owner']);
+			} catch(NoUserException $e) {
+				\OC::$server->getLogger()->warning('The user \'' . $share['uid_owner'] . '\' of share with ID \'' . $share['id'] . '\' can\'t be retrieved.', array('app' => 'files_sharing'));
+				return null;
+			}
 			// for updating etags for the share owner when we make changes to this share.
 			$ownerPropagator = $this->propagationManager->getChangePropagator($share['uid_owner']);
 
@@ -68,5 +74,7 @@ class MountProvider implements IMountProvider {
 				$storageFactory
 			);
 		}, $shares);
+		// array_filter removes the null values from the array
+		return array_filter($shares);
 	}
 }
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 212deb2..39c586c 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -365,6 +365,7 @@ class Filesystem {
 	 * Initialize system and personal mount points for a user
 	 *
 	 * @param string $user
+	 * @throws \OC\User\NoUserException if the user is not available
 	 */
 	public static function initMountPoints($user = '') {
 		if ($user == '') {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list