From: Thomas Müller Date: Mon, 30 Sep 2013 08:46:50 +0000 (+0200) Subject: Merge branch 'master' into fixing-4011-master X-Git-Tag: v6.0.0alpha2~77^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e3dee633393514402bc828e90b493d5168fdf837;p=nextcloud-server.git Merge branch 'master' into fixing-4011-master Conflicts: lib/connector/sabre/directory.php lib/connector/sabre/file.php --- e3dee633393514402bc828e90b493d5168fdf837 diff --cc lib/connector/sabre/directory.php index e36ac84652c,a50098df793..1e50d4cc7da --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@@ -54,9 -54,60 +54,65 @@@ class OC_Connector_Sabre_Directory exte throw new \Sabre_DAV_Exception_Forbidden(); } - if (isset($_SERVER['HTTP_OC_CHUNKED'])) { - $info = OC_FileChunking::decodeName($name); - if (empty($info)) { - throw new Sabre_DAV_Exception_NotImplemented(); - } - $chunk_handler = new OC_FileChunking($info); - $chunk_handler->store($info['index'], $data); - if ($chunk_handler->isComplete()) { - $newPath = $this->path . '/' . $info['name']; - $chunk_handler->file_assemble($newPath); - return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); - } - } else { - $newPath = $this->path . '/' . $name; - - // mark file as partial while uploading (ignored by the scanner) - $partpath = $newPath . '.part'; - - \OC\Files\Filesystem::file_put_contents($partpath, $data); - - //detect aborted upload - if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT' ) { - if (isset($_SERVER['CONTENT_LENGTH'])) { - $expected = $_SERVER['CONTENT_LENGTH']; - $actual = \OC\Files\Filesystem::filesize($partpath); - if ($actual != $expected) { - \OC\Files\Filesystem::unlink($partpath); - throw new Sabre_DAV_Exception_BadRequest( - 'expected filesize ' . $expected . ' got ' . $actual); - } - } - } - - // rename to correct path - $renameOkay = \OC\Files\Filesystem::rename($partpath, $newPath); - $fileExists = \OC\Files\Filesystem::file_exists($newPath); - if ($renameOkay === false || $fileExists === false) { - \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); - \OC\Files\Filesystem::unlink($partpath); - throw new Sabre_DAV_Exception(); - } - - // allow sync clients to send the mtime along in a header - $mtime = OC_Request::hasModificationTime(); - if ($mtime !== false) { - if(\OC\Files\Filesystem::touch($newPath, $mtime)) { - header('X-OC-MTime: accepted'); - } - } - - return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); - } - - return null; + $path = $this->path . '/' . $name; + $node = new OC_Connector_Sabre_File($path); + return $node->put($data); ++ ++// if (isset($_SERVER['HTTP_OC_CHUNKED'])) { ++// $info = OC_FileChunking::decodeName($name); ++// if (empty($info)) { ++// throw new Sabre_DAV_Exception_NotImplemented(); ++// } ++// $chunk_handler = new OC_FileChunking($info); ++// $chunk_handler->store($info['index'], $data); ++// if ($chunk_handler->isComplete()) { ++// $newPath = $this->path . '/' . $info['name']; ++// $chunk_handler->file_assemble($newPath); ++// return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); ++// } ++// } else { ++// $newPath = $this->path . '/' . $name; ++// ++// // mark file as partial while uploading (ignored by the scanner) ++// $partpath = $newPath . '.part'; ++// ++// \OC\Files\Filesystem::file_put_contents($partpath, $data); ++// ++// //detect aborted upload ++// if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT' ) { ++// if (isset($_SERVER['CONTENT_LENGTH'])) { ++// $expected = $_SERVER['CONTENT_LENGTH']; ++// $actual = \OC\Files\Filesystem::filesize($partpath); ++// if ($actual != $expected) { ++// \OC\Files\Filesystem::unlink($partpath); ++// throw new Sabre_DAV_Exception_BadRequest( ++// 'expected filesize ' . $expected . ' got ' . $actual); ++// } ++// } ++// } ++// ++// // rename to correct path ++// $renameOkay = \OC\Files\Filesystem::rename($partpath, $newPath); ++// $fileExists = \OC\Files\Filesystem::file_exists($newPath); ++// if ($renameOkay === false || $fileExists === false) { ++// \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); ++// \OC\Files\Filesystem::unlink($partpath); ++// throw new Sabre_DAV_Exception(); ++// } ++// ++// // allow sync clients to send the mtime along in a header ++// $mtime = OC_Request::hasModificationTime(); ++// if ($mtime !== false) { ++// if(\OC\Files\Filesystem::touch($newPath, $mtime)) { ++// header('X-OC-MTime: accepted'); ++// } ++// } ++// ++// return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath); ++// } ++// ++// return null; ++//>>>>>>> master } /** diff --cc lib/connector/sabre/file.php index aa4b886429c,433b1148552..b05c9fcb92a --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@@ -28,7 -28,7 +28,7 @@@ class OC_Connector_Sabre_File extends O * * The data argument is a readable stream resource. * -- * After a succesful put operation, you may choose to return an ETag. The ++ * After a successful put operation, you may choose to return an ETag. The * etag must always be surrounded by double-quotes. These quotes must * appear in the actual string you're returning. * @@@ -104,12 -74,19 +104,18 @@@ } // rename to correct path - $fs->rename($partpath, $this->path); - $renameOkay = \OC\Files\Filesystem::rename($partpath, $this->path); - $fileExists = \OC\Files\Filesystem::file_exists($this->path); ++ $renameOkay = $fs->rename($partpath, $this->path); ++ $fileExists = $fs->file_exists($this->path); + if ($renameOkay === false || $fileExists === false) { + \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); - \OC\Files\Filesystem::unlink($partpath); ++ $fs->unlink($partpath); + throw new Sabre_DAV_Exception(); + } - - //allow sync clients to send the mtime along in a header + // allow sync clients to send the mtime along in a header $mtime = OC_Request::hasModificationTime(); if ($mtime !== false) { - if (\OC\Files\Filesystem::touch($this->path, $mtime)) { + if($fs->touch($this->path, $mtime)) { header('X-OC-MTime: accepted'); } }