diff options
-rw-r--r-- | apps/dav/lib/Connector/Sabre/QuotaPlugin.php | 10 | ||||
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php index 687b05e86cb..b37325430e7 100644 --- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php +++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php @@ -250,11 +250,13 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin { } $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 4a9ca159bbd..ff864256cb7 100644 --- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php @@ -42,7 +42,6 @@ use Test\TestCase; * See the COPYING-README file. */ class QuotaPluginTest extends TestCase { - /** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject */ private $server; @@ -149,8 +148,8 @@ class QuotaPluginTest extends TestCase { [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']], ]; } |