diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 33cc966da2a6e..a535793b3433d 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -40,7 +40,7 @@ class OC_Helper { * @param int|float $bytes file size in bytes * @return string a human readable file size * - * Makes 2048 to 2 kB. + * Makes 2048 to 2 KiB. */ public static function humanFileSize(int|float $bytes): string { if ($bytes < 0) { @@ -51,23 +51,23 @@ public static function humanFileSize(int|float $bytes): string { } $bytes = round($bytes / 1024, 0); if ($bytes < 1024) { - return "$bytes KB"; + return "$bytes KiB"; } $bytes = round($bytes / 1024, 1); if ($bytes < 1024) { - return "$bytes MB"; + return "$bytes MiB"; } $bytes = round($bytes / 1024, 1); if ($bytes < 1024) { - return "$bytes GB"; + return "$bytes GiB"; } $bytes = round($bytes / 1024, 1); if ($bytes < 1024) { - return "$bytes TB"; + return "$bytes TiB"; } $bytes = round($bytes / 1024, 1); - return "$bytes PB"; + return "$bytes PiB"; } /** diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php index 85960ef6f08c5..b467bb3c69e48 100644 --- a/tests/lib/LegacyHelperTest.php +++ b/tests/lib/LegacyHelperTest.php @@ -34,12 +34,12 @@ public function testHumanFileSize($expected, $input) { public function humanFileSizeProvider() { return [ ['0 B', 0], - ['1 KB', 1024], - ['9.5 MB', 10000000], - ['1.3 GB', 1395864371], - ['465.7 GB', 500000000000], - ['454.7 TB', 500000000000000], - ['444.1 PB', 500000000000000000], + ['1 KiB', 1024], + ['9.5 MiB', 10000000], + ['1.3 GiB', 1395864371], + ['465.7 GiB', 500000000000], + ['454.7 TiB', 500000000000000], + ['444.1 PiB', 500000000000000000], ]; }