summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-09-08 10:00:15 +0200
committerVincent Petry <pvince81@owncloud.com>2014-09-08 10:00:15 +0200
commit637cff68ac2944d6029eb015640bbbd0e686641b (patch)
tree687609c275e24a50d31d6d045845a8a880b06d6f /lib
parent9fc45016f9b3359d146c1c7cad72650a24488cb8 (diff)
parent712487c861d56ae61459e86d4f50cf4c273a2133 (diff)
downloadnextcloud-server-637cff68ac2944d6029eb015640bbbd0e686641b.tar.gz
nextcloud-server-637cff68ac2944d6029eb015640bbbd0e686641b.zip
Merge pull request #10862 from chli1/master
fix BadRequest error if CONTENT_LENGTH not set
Diffstat (limited to 'lib')
-rw-r--r--lib/private/connector/sabre/file.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php
index 44c86e69719..5333583e78d 100644
--- a/lib/private/connector/sabre/file.php
+++ b/lib/private/connector/sabre/file.php
@@ -102,13 +102,16 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
}
+ // if content length is sent by client:
// double check if the file was fully received
// compare expected and actual size
- $expected = $_SERVER['CONTENT_LENGTH'];
- $actual = $this->fileView->filesize($partFilePath);
- if ($actual != $expected) {
- $this->fileView->unlink($partFilePath);
- throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
+ if (isset($_SERVER['CONTENT_LENGTH'])) {
+ $expected = $_SERVER['CONTENT_LENGTH'];
+ $actual = $this->fileView->filesize($partFilePath);
+ if ($actual != $expected) {
+ $this->fileView->unlink($partFilePath);
+ throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
+ }
}
// rename to correct path