From 25dbbbadd33ad1f859498ff8c6ba16091959bce4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Fri, 27 Jun 2014 15:00:29 +0200 Subject: [PATCH] use normalize path to convert '.' to '' in objectstorestorage --- .../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 09114d26de9..85f43b90cbb 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); -- 2.39.5