Fix renaming files in the root folder of a MappedLocal storage

This commit is contained in:
Robin Appelman 2014-07-16 21:24:18 +02:00
parent d58c8d72cf
commit 5a0397eb5e
1 changed files with 17 additions and 2 deletions

View File

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