]> source.dussan.org Git - nextcloud-server.git/commitdiff
only check content lenght on PUT to make litmus happy
authorJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 11 Feb 2013 09:31:01 +0000 (10:31 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 11 Feb 2013 09:31:01 +0000 (10:31 +0100)
lib/connector/sabre/directory.php
lib/connector/sabre/file.php

index f92451153532b2b22c679ff874fe381f2f9e288e..e29059d03954eb55209840737af90d01756e5e4c 100644 (file)
@@ -69,13 +69,15 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
                        \OC\Files\Filesystem::file_put_contents($partpath, $data);
                        
                        //detect aborted upload
-                       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);
+                       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);
+                                       }
                                }
                        }
                        
index e5436f0ad128c48adad6fffd58a7445a27708255..61165d9956d47d3fdd5fcd0f1e27405d02ad0a98 100644 (file)
@@ -51,13 +51,15 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
                \OC\Files\Filesystem::file_put_contents($partpath, $data);
                
                //detect aborted upload
-               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);
+               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);
+                               }
                        }
                }