summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-04-12 15:56:15 +0200
committerGitHub <noreply@github.com>2017-04-12 15:56:15 +0200
commit3cf2f6e31bca4b704549e428d7fcbf6c4ecd6c37 (patch)
tree7188871b17cbdfadb802a9021f850b06d8725497
parentc996e91d5914e96c443dd85ba67da38583d9ca6c (diff)
parenta3c31247628e927ab53f6f76c07dfedf391cd0b2 (diff)
downloadnextcloud-server-3cf2f6e31bca4b704549e428d7fcbf6c4ecd6c37.tar.gz
nextcloud-server-3cf2f6e31bca4b704549e428d7fcbf6c4ecd6c37.zip
Merge pull request #4323 from nextcloud/downstream-27613
Allow file upload when storage is unlimited
-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')),
);
}