Removed special handling of part files in shared storage rename

This fixes the issue introduced by the transfer id which itself wasn't
taken into account by the shortcut code for part file in the shared
storage class.
This commit is contained in:
Vincent Petry 2014-01-08 18:43:20 +01:00
parent bb443ae937
commit 8eaa39f4e2
2 changed files with 16 additions and 22 deletions

View File

@ -293,14 +293,6 @@ class Shared extends \OC\Files\Storage\Common {
}
public function rename($path1, $path2) {
// Check for partial files
if (pathinfo($path1, PATHINFO_EXTENSION) === 'part') {
if ($oldSource = $this->getSourcePath($path1)) {
list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
$newInternalPath = substr($oldInternalPath, 0, -5);
return $storage->rename($oldInternalPath, $newInternalPath);
}
} else {
// Renaming/moving is only allowed within shared folders
$pos1 = strpos($path1, '/', 1);
$pos2 = strpos($path2, '/', 1);
@ -317,7 +309,6 @@ class Shared extends \OC\Files\Storage\Common {
return $rootView->rename($oldSource, $newSource);
}
}
}
return false;
}

View File

@ -242,7 +242,10 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
$fileExists = $fs->file_exists($targetPath);
if ($renameOkay === false || $fileExists === false) {
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
// only delete if an error occurred and the target file was already created
if ($fileExists) {
$fs->unlink($targetPath);
}
throw new Sabre_DAV_Exception();
}