Skip to content

Commit

Permalink
Merge pull request #44656 from nextcloud/backport/44332/stable27
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Apr 4, 2024
2 parents adea4af + 06c713d commit 4436964
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 6 additions & 4 deletions apps/dav/lib/Connector/Sabre/QuotaPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,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);
}

/**
Expand Down
5 changes: 2 additions & 3 deletions apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* See the COPYING-README file.
*/
class QuotaPluginTest extends TestCase {

/** @var \Sabre\DAV\Server | \PHPUnit\Framework\MockObject\MockObject */
private $server;

Expand Down Expand Up @@ -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']],
];
}

Expand Down

0 comments on commit 4436964

Please sign in to comment.