diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-27 15:00:29 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-27 15:00:29 +0200 |
commit | 25dbbbadd33ad1f859498ff8c6ba16091959bce4 (patch) | |
tree | 0a974fcef9792aff598a7fce0fe1a0a148deedad /lib | |
parent | ab93f1949dab8e71299b27552e527beb04f89de4 (diff) | |
download | nextcloud-server-25dbbbadd33ad1f859498ff8c6ba16091959bce4.tar.gz nextcloud-server-25dbbbadd33ad1f859498ff8c6ba16091959bce4.zip |
use normalize path to convert '.' to '' in objectstorestorage
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/objectstore/objectstorestorage.php | 20 |
1 files 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); |