From dbd5ba03773e9c6f7c194fc15bc2d43bad23abbc Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 13 Mar 2024 09:56:31 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B07302=20Fix=20SetupUtilsTest::testHumanRe?= =?UTF-8?q?adableSize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/setuputils.class.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index cc49bcdc5..329a6b9f8 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -910,12 +910,16 @@ class SetupUtils { $aSizes = array('bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); $index = 0; - while (($fBytes > 1000) && ($index < count($aSizes))) - { + while (($fBytes > 1000) && ($index < count($aSizes))) { $index++; $fBytes = $fBytes / 1000; } + if ($index == 0) { + // display int for bytes + return sprintf('%d %s', $fBytes, $aSizes[$index]); + } + return sprintf('%.2f %s', $fBytes, $aSizes[$index]); }