Allow file upload when storage is unlimited

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-04-12 12:27:47 +02:00
parent af42ca2025
commit a3c3124762
No known key found for this signature in database
GPG key ID: E166FD8976B3BAC8
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')),
);
}