summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-10-19 11:01:19 +0200
committerGitHub <noreply@github.com>2016-10-19 11:01:19 +0200
commite072057dd8167f85e4bde6e9b687548a8a64f10d (patch)
treedb417ae0bcda1e5f38e9542a8dc55f649aa6b3b0 /apps
parent5e48ce98c70fa511ea2c1caeb332594912c9d96a (diff)
parent05223a39f9f29181c242cc6952c91b74a70c969a (diff)
downloadnextcloud-server-e072057dd8167f85e4bde6e9b687548a8a64f10d.tar.gz
nextcloud-server-e072057dd8167f85e4bde6e9b687548a8a64f10d.zip
Merge pull request #1740 from nextcloud/issue-1707-big-files-on-32-bits
Make sure we only use numbers as length
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/QuotaPlugin.php5
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php6
2 files changed, 9 insertions, 2 deletions
diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
index 0682fca94ea..484bb5129e8 100644
--- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
@@ -120,12 +120,13 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
public function getLength() {
$req = $this->server->httpRequest;
$length = $req->getHeader('X-Expected-Entity-Length');
- if (!$length) {
+ if (!is_numeric($length)) {
$length = $req->getHeader('Content-Length');
+ $length = is_numeric($length) ? $length : null;
}
$ocLength = $req->getHeader('OC-Total-Length');
- if ($length && $ocLength) {
+ if (is_numeric($length) && is_numeric($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 48c920541a8..89bc1ee8adb 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -132,6 +132,12 @@ class QuotaPluginTest extends \Test\TestCase {
array(512, array('CONTENT-LENGTH' => '512')),
array(2048, array('OC-TOTAL-LENGTH' => '2048', 'CONTENT-LENGTH' => '1024')),
array(4096, array('OC-TOTAL-LENGTH' => '2048', 'X-EXPECTED-ENTITY-LENGTH' => '4096')),
+ [null, ['X-EXPECTED-ENTITY-LENGTH' => 'A']],
+ [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']],
);
}