summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-12 12:27:47 +0200
committerJoas Schilling <coding@schilljs.com>2017-04-12 12:27:47 +0200
commita3c31247628e927ab53f6f76c07dfedf391cd0b2 (patch)
tree6101c9b229183d79c804a20d14ba09fe6bd2e851 /apps
parentaf42ca20252b166bec2da34970137ec790a18328 (diff)
downloadnextcloud-server-a3c31247628e927ab53f6f76c07dfedf391cd0b2.tar.gz
nextcloud-server-a3c31247628e927ab53f6f76c07dfedf391cd0b2.zip
Allow file upload when storage is unlimited
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/QuotaPlugin.php2
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php16
2 files changed, 12 insertions, 6 deletions
diff --git a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
index 4aef5fc8a5a..f0958c353a1 100644
--- a/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/QuotaPlugin.php
@@ -106,7 +106,7 @@ class QuotaPlugin extends \Sabre\DAV\ServerPlugin {
$uri = rtrim($parentUri, '/') . '/' . $info['name'];
}
$freeSpace = $this->getFreeSpace($uri);
- if ($freeSpace !== FileInfo::SPACE_UNKNOWN && $length > $freeSpace) {
+ if ($freeSpace !== FileInfo::SPACE_UNKNOWN && $freeSpace !== FileInfo::SPACE_UNLIMITED && $length > $freeSpace) {
if (isset($chunkHandler)) {
$chunkHandler->cleanup();
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
index b37abdc9b05..6286362f47d 100644
--- a/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
@@ -24,6 +24,7 @@
*
*/
namespace OCA\DAV\Tests\unit\Connector\Sabre;
+use OCP\Files\FileInfo;
use Test\TestCase;
/**
@@ -107,11 +108,16 @@ class QuotaPluginTest extends TestCase {
array(1024, array('X-EXPECTED-ENTITY-LENGTH' => '1024')),
array(1024, array('CONTENT-LENGTH' => '512')),
array(1024, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')),
- // \OCP\Files\FileInfo::SPACE-UNKNOWN = -2
- array(-2, array()),
- array(-2, array('X-EXPECTED-ENTITY-LENGTH' => '1024')),
- array(-2, array('CONTENT-LENGTH' => '512')),
- array(-2, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')),
+
+ array(FileInfo::SPACE_UNKNOWN, array()),
+ array(FileInfo::SPACE_UNKNOWN, array('X-EXPECTED-ENTITY-LENGTH' => '1024')),
+ array(FileInfo::SPACE_UNKNOWN, array('CONTENT-LENGTH' => '512')),
+ array(FileInfo::SPACE_UNKNOWN, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')),
+
+ array(FileInfo::SPACE_UNLIMITED, array()),
+ array(FileInfo::SPACE_UNLIMITED, array('X-EXPECTED-ENTITY-LENGTH' => '1024')),
+ array(FileInfo::SPACE_UNLIMITED, array('CONTENT-LENGTH' => '512')),
+ array(FileInfo::SPACE_UNLIMITED, array('OC-TOTAL-LENGTH' => '1024', 'CONTENT-LENGTH' => '512')),
);
}