summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-02-11 10:31:01 +0100
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-02-11 10:31:01 +0100
commit99f41de7de4e96f5d490cfc8f3b962171d201587 (patch)
tree4c785f7f83d9f1ebc74282042bd07f5f52bb644b
parent2cb2991c049387290d6ba71a08381aeac4de2fe3 (diff)
downloadnextcloud-server-99f41de7de4e96f5d490cfc8f3b962171d201587.tar.gz
nextcloud-server-99f41de7de4e96f5d490cfc8f3b962171d201587.zip
only check content lenght on PUT to make litmus happy
-rw-r--r--lib/connector/sabre/directory.php16
-rw-r--r--lib/connector/sabre/file.php16
2 files changed, 18 insertions, 14 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index f9245115353..e29059d0395 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -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);
+ }
}
}
diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php
index e5436f0ad12..61165d9956d 100644
--- a/lib/connector/sabre/file.php
+++ b/lib/connector/sabre/file.php
@@ -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);
+ }
}
}