]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix renaming files in the root folder of a MappedLocal storage
authorRobin Appelman <icewind@owncloud.com>
Wed, 16 Jul 2014 19:24:18 +0000 (21:24 +0200)
committerRobin Appelman <icewind@owncloud.com>
Wed, 16 Jul 2014 19:24:18 +0000 (21:24 +0200)
lib/private/files/storage/mappedlocal.php

index 6910eef74013111da4d2f78a023457b14f53ba32..c4a8dc1961c083221924446a5978e065c8342721 100644 (file)
@@ -184,8 +184,8 @@ class MappedLocal extends \OC\Files\Storage\Common {
        }
 
        public function rename($path1, $path2) {
-               $srcParent = dirname($path1);
-               $dstParent = dirname($path2);
+               $srcParent = $this->dirname($path1);
+               $dstParent = $this->dirname($path2);
 
                if (!$this->isUpdatable($srcParent)) {
                        \OC_Log::write('core', 'unable to rename, source directory is not writable : ' . $srcParent, \OC_Log::ERROR);
@@ -355,6 +355,8 @@ class MappedLocal extends \OC\Files\Storage\Common {
 
        /**
         * @param string $path
+        * @param bool $create
+        * @return string
         */
        private function buildPath($path, $create = true) {
                $path = $this->stripLeading($path);
@@ -362,6 +364,19 @@ class MappedLocal extends \OC\Files\Storage\Common {
                return $this->mapper->logicToPhysical($fullPath, $create);
        }
 
+       /**
+        * @param string $path
+        * @return string
+        */
+       private function dirName($path) {
+               $path = dirname($path);
+               if ($path === '.') {
+                       return '';
+               } else {
+                       return $path;
+               }
+       }
+
        /**
         * @param string $path
         */