[Pkg-owncloud-commits] [owncloud] 90/199: get mount point from mount manager

David Prévot taffit at moszumanska.debian.org
Sun Jun 1 18:53:13 UTC 2014


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

taffit pushed a commit to branch master
in repository owncloud.

commit 9ed5083efd2e150cf5856160b0ff73744eb697d2
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date:   Wed May 28 17:18:41 2014 +0200

    get mount point from mount manager
---
 apps/files_encryption/hooks/hooks.php | 22 ++++++----------------
 apps/files_encryption/lib/util.php    |  5 +++--
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 6e375f9..f2096c3 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -320,14 +320,9 @@ class Hooks {
 
 			$sharingEnabled = \OCP\Share::isEnabled();
 
-			// get the path including mount point only if not a shared folder
-			list($storage, ) = \OC\Files\Filesystem::resolvePath('/' . $userId . '/files' . $path);
-
-			if (!($storage instanceof \OC\Files\Storage\Local)) {
-				$mountPoint = 'files' . $storage->getMountPoint();
-			} else {
-				$mountPoint = '';
-			}
+			$mountManager = \OC\Files\Filesystem::getMountManager();
+			$mount = $mountManager->find('/' . $userId . '/files' . $path);
+			$mountPoint = $mount->getMountPoint();
 
 			// if a folder was shared, get a list of all (sub-)folders
 			if ($params['itemType'] === 'folder') {
@@ -370,14 +365,9 @@ class Hooks {
 				}
 			}
 
-			// get the path including mount point only if not a shared folder
-			list($storage, ) = \OC\Files\Filesystem::resolvePath('/' . $userId . '/files' . $path);
-
-			if (!($storage instanceof \OC\Files\Storage\Local)) {
-				$mountPoint = 'files' . $storage->getMountPoint();
-			} else {
-				$mountPoint = '';
-			}
+			$mountManager = \OC\Files\Filesystem::getMountManager();
+			$mount = $mountManager->find('/' . $userId . '/files' . $path);
+			$mountPoint = $mount->getMountPoint();
 
 			// if we unshare a folder we need a list of all (sub-)files
 			if ($params['itemType'] === 'folder') {
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index d20efc3..991960b 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1384,10 +1384,11 @@ class Util {
 				// getDirectoryContent() returns the paths relative to the mount points, so we need
 				// to re-construct the complete path
 				$path = ($mountPoint !== '') ? $mountPoint . '/' .  $c['path'] : $c['path'];
+				$path = \OC\Files\Filesystem::normalizePath($path);
 				if ($c['type'] === 'dir') {
-					$dirList[] = substr($path, strlen("files"));
+					$dirList[] = substr($path, strlen('/' . \OCP\User::getUser() . "/files"));
 				} else {
-					$result[] = substr($path, strlen("files"));
+					$result[] = substr($path, strlen('/' . \OCP\User::getUser() . "/files"));
 				}
 			}
 

-- 
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