diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-22 13:06:20 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-07-22 13:06:20 +0200 |
commit | 31149fb1c3591d968c38a256f54b32fa22222247 (patch) | |
tree | 5076cd50159fc25c940afdaef9f5f222e3820531 | |
parent | 5565eabb8170cf5ad5c0e38ea2014371d8de4ba5 (diff) | |
download | nextcloud-server-31149fb1c3591d968c38a256f54b32fa22222247.tar.gz nextcloud-server-31149fb1c3591d968c38a256f54b32fa22222247.zip |
adding special handling of checkPrecondition() for chunked upload
-rw-r--r-- | lib/private/connector/sabre/server.php | 31 |
1 files changed, 31 insertions, 0 deletions
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 @@ -29,6 +29,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 */ protected function httpPropfind($uri) { |