]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding special handling of checkPrecondition() for chunked upload
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 22 Jul 2014 11:06:20 +0000 (13:06 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Tue, 22 Jul 2014 13:49:20 +0000 (15:49 +0200)
lib/private/connector/sabre/server.php

index e4ee5dcefbf64e87c524842623f9db41ae07d620..aaf4fe85af956eaea8d286ee9a1f5c66592d5cd7 100644 (file)
  */
 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
         */