From: Thomas Müller Date: Tue, 22 Jul 2014 11:06:20 +0000 (+0200) Subject: adding special handling of checkPrecondition() for chunked upload X-Git-Tag: v7.0.1RC1~3^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61d99672216aa5972c4d852619ec6835a43ca97f;p=nextcloud-server.git adding special handling of checkPrecondition() for chunked upload --- diff --git a/lib/private/connector/sabre/server.php b/lib/private/connector/sabre/server.php index e4ee5dcefbf..aaf4fe85af9 100644 --- a/lib/private/connector/sabre/server.php +++ b/lib/private/connector/sabre/server.php @@ -28,6 +28,37 @@ */ class OC_Connector_Sabre_Server extends Sabre\DAV\Server { + /** + * @var string + */ + private $overLoadedUri = null; + + public function getRequestUri() { + + if (!is_null($this->overLoadedUri)) { + return $this->overLoadedUri; + } + + return parent::getRequestUri(); + } + + public function checkPreconditions($handleAsGET = false) { + // chunked upload handling + if (isset($_SERVER['HTTP_OC_CHUNKED'])) { + $filePath = parent::getRequestUri(); + list($path, $name) = \Sabre\DAV\URLUtil::splitPath($filePath); + $info = OC_FileChunking::decodeName($name); + if (!empty($info)) { + $filePath = $path . '/' . $info['name']; + $this->overLoadedUri = $filePath; + } + } + + $result = parent::checkPreconditions($handleAsGET); + $this->overLoadedUri = null; + return $result; + } + /** * @see \Sabre\DAV\Server */