aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-04-02 17:44:21 +0200
committerGitHub <noreply@github.com>2024-04-02 17:44:21 +0200
commit9aa7225ed3e78c2e418c983e65bdc1f1787b9940 (patch)
tree446e7880f03fa76414b8c631691ce1c5d7597c4e /apps
parent1722739a4430299488b6edd088c6cac534d43db3 (diff)
parent01f59be55a5028fdbbf034c41f55f715955f356a (diff)
downloadnextcloud-server-9aa7225ed3e78c2e418c983e65bdc1f1787b9940.tar.gz
nextcloud-server-9aa7225ed3e78c2e418c983e65bdc1f1787b9940.zip
Merge pull request #44332 from nextcloud/fix/fix-chunkupload-quota-check
fix(dav): Fix quota check for chunk upload
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/QuotaPlugin.php10
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php5
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']],
];
}