Merge pull request #8926 from nextcloud/ocs-api-quota-fallback

Return quota even if user is not initialised
This commit is contained in:
blizzz 2018-04-04 17:19:54 +02:00 committed by GitHub
commit 3678d3b14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -909,7 +909,16 @@ class UsersController extends OCSController {
'quota' => $storage['quota'],
];
} catch (NotFoundException $ex) {
$data = [];
// User fs is not setup yet
$user = $this->userManager->get($userId);
if ($user === null) {
throw new OCSException('User does not exist', 101);
}
$quota = OC_Helper::computerFileSize($user->getQuota());
$data = [
'quota' => $quota ? $quota : 'none',
'used' => 0
];
}
return $data;
}