Merge pull request #4323 from nextcloud/downstream-27613

Allow file upload when storage is unlimited
This commit is contained in:
Roeland Jago Douma 2017-04-12 15:56:15 +02:00 committed by GitHub
commit 3cf2f6e31b
2 changed files with 12 additions and 6 deletions

View File

@ -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();
}

View File

@ -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')),
);
}