diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index 687b05e86cb89..b37325430e745 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -250,11 +250,13 @@ public function getLength() { } $ocLength = $req->getHeader('OC-Total-Length'); - if (is_numeric($length) && is_numeric($ocLength)) { - return max($length, $ocLength); + if (!is_numeric($ocLength)) { + return $length; } - - return $length; + if (!is_numeric($length)) { + return $ocLength; + } + return max($length, $ocLength); } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php index 4a9ca159bbd8c..ff864256cb755 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -42,7 +42,6 @@ * See the COPYING-README file. */ class QuotaPluginTest extends TestCase { - /** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject */ private $server; @@ -149,8 +148,8 @@ public function lengthProvider() { [null, ['CONTENT-LENGTH' => 'A']], [1024, ['OC-TOTAL-LENGTH' => 'A', 'CONTENT-LENGTH' => '1024']], [1024, ['OC-TOTAL-LENGTH' => 'A', 'X-EXPECTED-ENTITY-LENGTH' => '1024']], - [null, ['OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => 'A']], - [null, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => 'A']], + [2048, ['OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => 'A']], + [2048, ['OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => 'A']], ]; }