[Pkg-owncloud-commits] [owncloud] 89/273: use normalize path to convert '.' to '' in objectstorestorage

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:13:02 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 25dbbbadd33ad1f859498ff8c6ba16091959bce4
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Fri Jun 27 15:00:29 2014 +0200

    use normalize path to convert '.' to '' in objectstorestorage
---
 lib/private/files/objectstore/objectstorestorage.php | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index 09114d2..85f43b9 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -62,7 +62,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 			return false;
 		}
 
-		$dirName = dirname($path);
+		$dirName = $this->normalizePath(dirname($path));
 		$parentExists = $this->is_dir($dirName);
 
 		$mTime = time();
@@ -75,11 +75,16 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 			'permissions' => \OCP\PERMISSION_ALL,
 		);
 
-		if ($dirName === '.' && !$parentExists) {
+		if ($dirName === '' && !$parentExists) {
 			//create root on the fly
-			$data['etag'] = $this->getETag($dirName);
+			$data['etag'] = $this->getETag('');
 			$this->getCache()->put('', $data);
 			$parentExists = true;
+
+			// we are done when the root folder was meant to be created
+			if  ($dirName === $path) {
+				return true;
+			}
 		}
 
 		if ($parentExists) {
@@ -99,8 +104,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 		//FIXME why do we sometimes get a path like 'files//username'?
 		$path = str_replace('//', '/', $path);
 
-		if (!$path) {
-			$path = '.';
+		// dirname('/folder') returns '.' but internally (in the cache) we store the root as ''
+		if (!$path || $path === '.') {
+			$path = '';
 		}
 
 		return $path;
@@ -200,10 +206,6 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 	public function opendir($path) {
 		$path = $this->normalizePath($path);
 
-		if ($path === '.') {
-			$path = '';
-		}
-
 		try {
 			$files = array();
 			$folderContents = $this->getCache()->getFolderContents($path);

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