From 24c5a92e4650cdbd8b49a6b6af18015915550049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 2 Aug 2026 13:38:30 +0200 Subject: [PATCH] Show file sizes with an B for byte unit, Use an lowercase for k fo kilo and added an whitespace between number and unit --- src/Services/Attachments/AttachmentManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php index c661b0f4..63746364 100644 --- a/src/Services/Attachments/AttachmentManager.php +++ b/src/Services/Attachments/AttachmentManager.php @@ -155,9 +155,9 @@ class AttachmentManager //Format filesize for human reading //Taken from: https://www.php.net/manual/de/function.filesize.php#106569 and slightly modified - $sz = 'BKMGTP'; + $sz = 'BkMGTP'; $factor = min((int) floor((strlen((string) $bytes) - 1) / 3), strlen($sz) - 1); - //Use real (10 based) SI prefixes - return sprintf("%.{$decimals}f", $bytes / 1000 ** $factor).$sz[$factor]; + //Use real (10 based) SI prefixes, and add a non-breaking space between the number and the unit, so that the unit is not separated from the number when wrapping text. + return sprintf("%.{$decimals}f\u{00A0}", $bytes / 1000 ** $factor).$sz[$factor] . 'B'; } }