|
|
|
@ -223,9 +223,22 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($chunk_handler->isComplete()) { |
|
|
|
|
$newPath = $path . '/' . $info['name']; |
|
|
|
|
$chunk_handler->file_assemble($newPath); |
|
|
|
|
return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); |
|
|
|
|
|
|
|
|
|
// we first assembly the target file as a part file |
|
|
|
|
$partFile = $path . '/' . $info['name'] . '-' . $info['transferid'] . '.part'; |
|
|
|
|
$chunk_handler->file_assemble($partFile); |
|
|
|
|
|
|
|
|
|
// here is the final atomic rename |
|
|
|
|
$fs = $this->getFS(); |
|
|
|
|
$targetPath = $path . '/' . $info['name']; |
|
|
|
|
$renameOkay = $fs->rename($partFile, $targetPath); |
|
|
|
|
$fileExists = $fs->file_exists($targetPath); |
|
|
|
|
if ($renameOkay === false || $fileExists === false) { |
|
|
|
|
\OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); |
|
|
|
|
$fs->unlink($targetPath); |
|
|
|
|
throw new Sabre_DAV_Exception(); |
|
|
|
|
} |
|
|
|
|
return OC_Connector_Sabre_Node::getETagPropertyForPath($targetPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|