Merge pull request #10862 from chli1/master
fix BadRequest error if CONTENT_LENGTH not set
This commit is contained in:
commit
637cff68ac
|
@ -102,14 +102,17 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\
|
||||||
throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e);
|
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
|
// double check if the file was fully received
|
||||||
// compare expected and actual size
|
// compare expected and actual size
|
||||||
|
if (isset($_SERVER['CONTENT_LENGTH'])) {
|
||||||
$expected = $_SERVER['CONTENT_LENGTH'];
|
$expected = $_SERVER['CONTENT_LENGTH'];
|
||||||
$actual = $this->fileView->filesize($partFilePath);
|
$actual = $this->fileView->filesize($partFilePath);
|
||||||
if ($actual != $expected) {
|
if ($actual != $expected) {
|
||||||
$this->fileView->unlink($partFilePath);
|
$this->fileView->unlink($partFilePath);
|
||||||
throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
|
throw new \Sabre\DAV\Exception\BadRequest('expected filesize ' . $expected . ' got ' . $actual);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// rename to correct path
|
// rename to correct path
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue