Merge pull request #19436 from nextcloud/bugfix/noid/dav-quota-calculation

Do not include mountpoints when calculating quota usage on WebDAV
This commit is contained in:
Roeland Jago Douma 2020-04-30 09:13:19 +02:00 committed by GitHub
commit b8b53a2d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View File

@ -326,7 +326,8 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
return $this->quotaInfo;
}
try {
$storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $this->info);
$info = $this->fileView->getFileInfo($this->path, false);
$storageInfo = \OC_Helper::getStorageInfo($this->info->getPath(), $info);
if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
$free = \OCP\Files\FileInfo::SPACE_UNLIMITED;
} else {

View File

@ -295,6 +295,10 @@ class DirectoryTest extends \Test\TestCase {
->method('getStorage')
->willReturn($storage);
$this->view->expects($this->once())
->method('getFileInfo')
->willReturn($this->info);
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, -3], $dir->getQuotaInfo()); //200 used, unlimited
}
@ -327,6 +331,10 @@ class DirectoryTest extends \Test\TestCase {
->method('getStorage')
->willReturn($storage);
$this->view->expects($this->once())
->method('getFileInfo')
->willReturn($this->info);
$dir = new Directory($this->view, $this->info);
$this->assertEquals([200, 800], $dir->getQuotaInfo()); //200 used, 800 free
}