summaryrefslogtreecommitdiffstats
path: root/lib/private/User
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-23 12:24:53 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-02-07 11:23:30 +0100
commit5aed587e2516417ea72f4ea84772ceaa6df58141 (patch)
treea240008514ebd5ed7742cfdfaf4cf885fbda0392 /lib/private/User
parentd00422b812d27df56ca9e07159fc14073357f0c4 (diff)
downloadnextcloud-server-5aed587e2516417ea72f4ea84772ceaa6df58141.tar.gz
nextcloud-server-5aed587e2516417ea72f4ea84772ceaa6df58141.zip
Fix setQuota on User on 32bits
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/User')
-rw-r--r--lib/private/User/User.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index 7044770b57e..2b975c290ba 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -513,13 +513,17 @@ class User implements IUser {
*
* @param string $quota
* @return void
+ * @throws InvalidArgumentException
* @since 9.0.0
*/
public function setQuota($quota) {
$oldQuota = $this->config->getUserValue($this->uid, 'files', 'quota', '');
if ($quota !== 'none' and $quota !== 'default') {
- $quota = OC_Helper::computerFileSize($quota);
- $quota = OC_Helper::humanFileSize((int)$quota);
+ $bytesQuota = OC_Helper::computerFileSize($quota);
+ if ($bytesQuota === false) {
+ throw new InvalidArgumentException('Failed to set quota to invalid value '.$quota);
+ }
+ $quota = OC_Helper::humanFileSize($bytesQuota);
}
if ($quota !== $oldQuota) {
$this->config->setUserValue($this->uid, 'files', 'quota', $quota);