[Pkg-owncloud-commits] [owncloud] 07/85: Fix getPath for storage roots

David Prévot taffit at moszumanska.debian.org
Tue Jun 17 19:12:40 UTC 2014


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

taffit pushed a commit to branch 6.0
in repository owncloud.

commit d2dbab21fb2e13498c30533740fd64428134616d
Author: Robin Appelman <icewind at owncloud.com>
Date:   Tue Apr 22 16:05:30 2014 +0200

    Fix getPath for storage roots
---
 lib/private/files/view.php |  4 ++--
 tests/lib/files/view.php   | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 70affde..8309dab 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -1101,10 +1101,10 @@ class View {
 			 * @var \OC\Files\Mount\Mount $mount
 			 */
 			$cache = $mount->getStorage()->getCache();
-			if ($internalPath = $cache->getPathById($id)) {
+			if (!is_null($internalPath = $cache->getPathById($id))) {
 				$fullPath = $mount->getMountPoint() . $internalPath;
 				if (!is_null($path = $this->getRelativePath($fullPath))) {
-					return $path;
+					return rtrim($path, '/');
 				}
 			}
 		}
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 72a2f85..d793aeb 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -150,6 +150,22 @@ class View extends \PHPUnit_Framework_TestCase {
 	/**
 	 * @medium
 	 */
+	function testGetPathStorageRoot() {
+		$storage1 = $this->getTestStorage();
+		$storage2 = $this->getTestStorage();
+		\OC\Files\Filesystem::mount($storage1, array(), '/');
+		\OC\Files\Filesystem::mount($storage2, array(), '/substorage');
+
+		$rootView = new \OC\Files\View('');
+
+		$cachedData = $rootView->getFileInfo('/substorage');
+		$id1 = $cachedData['fileid'];
+		$this->assertEquals('/substorage', $rootView->getPath($id1));
+	}
+
+	/**
+	 * @medium
+	 */
 	function testMountPointOverwrite() {
 		$storage1 = $this->getTestStorage(false);
 		$storage2 = $this->getTestStorage();

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