From d524329ec3cb51484fa7218e9067a379546e5d20 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 22 Nov 2022 18:03:07 +0100 Subject: [PATCH 1/2] Revert "Fix quota type to int" This reverts commit d61efdff6c53cb8588b1f54e2b096b336b5163b2. Signed-off-by: Vincent Petry --- lib/private/legacy/OC_Helper.php | 6 +++--- lib/private/legacy/OC_Util.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 3b409fd1d0406..e2bd7de2fbac3 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -95,7 +95,7 @@ public static function humanFileSize($bytes) { /** * Make a computer file size * @param string $str file size in human readable format - * @return int|false a file size in bytes + * @return float|false a file size in bytes * * Makes 2kB to 2048. * @@ -104,7 +104,7 @@ public static function humanFileSize($bytes) { public static function computerFileSize($str) { $str = strtolower($str); if (is_numeric($str)) { - return (int)$str; + return (float)$str; } $bytes_array = [ @@ -131,7 +131,7 @@ public static function computerFileSize($str) { $bytes = round($bytes); - return (int)$bytes; + return $bytes; } /** diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 88cd6baddc50e..0130d503a895c 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -158,7 +158,7 @@ public static function isDefaultExpireDateEnforced() { * Get the quota of a user * * @param IUser|null $user - * @return int|\OCP\Files\FileInfo::SPACE_UNLIMITED|false Quota bytes + * @return float|\OCP\Files\FileInfo::SPACE_UNLIMITED|false Quota bytes */ public static function getUserQuota(?IUser $user) { if (is_null($user)) { From 7bcd4193b8f58ea36d76d03d672b1b5c92831dc1 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 23 Nov 2022 11:24:53 +0100 Subject: [PATCH 2/2] Float the quota Signed-off-by: Vincent Petry --- lib/private/legacy/OC_Helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index e2bd7de2fbac3..de42a7bc7fc21 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -577,7 +577,7 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin /** * Get storage info including all mount points and quota */ - private static function getGlobalStorageInfo(int $quota, IUser $user, IMountPoint $mount): array { + private static function getGlobalStorageInfo(float $quota, IUser $user, IMountPoint $mount): array { $rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext'); $used = $rootInfo['size']; if ($used < 0) {