You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Size formatters print "1000 KB", "1024 KB" and "100.0 KB" at unit boundaries #141
bytes() in web/src/ui.tsx (line 23) picks the unit first and rounds afterwards, so a value just below a unit boundary rounds up to the boundary and keeps the smaller unit:
bytes(999999) -> "1000 KB" (should be "1.0 MB")
bytes(99950) -> "100.0 KB" (the 100+ branch prints no decimals, so it should be "100 KB")
bytes(999999999999999) -> "1000 TB" (should be "1.0 PB")
bytes(1048575, 1, 1024) -> "1024 KB" (should be "1.0 MB")
bytes(1023.6, 1, 1024) -> "1024 B"
The other copies of this helper have the same flaw with base 1024: bytes in web/src/backups.tsx (line 48) and bytes in web/src/unraid.tsx (line 17) both print "1024 KB" for 1048575 (the loop stops at n >= 1024, but toFixed(0) then rounds 1023.999 up). web/src/swarm/gauges.ts (line 29) is a verbatim copy of the ui.tsx version.
Users see these in file sizes, disk and memory gauges, backup sizes and the Unraid import list, for example a 999,999 byte file shown as "1000 KB".
How to reproduce
I copied the function into a scratch .mjs file and ran it:
Round first, then check whether the rounded value reached the base and move to the next unit (or decide the number of digits from the rounded value). Better, keep one shared helper instead of four copies.
This stays the single issue for the size formatter printing "1000 KB", "1024 KB", and "100.0 KB". The report already covers the copies in web/src/ui.tsx, web/src/backups.tsx, web/src/unraid.tsx, and web/src/swarm/gauges.ts.
#436 stays separate. That one is the Machines screen labelling a binary size "GB".
Thank you @nixfred. Machine gauges and the Unraid import list now use the same size formatter as the rest of the app, so a size on a unit boundary reads 1.0 MB. Merged in #1273.
Activity
calledtoconstruct commentedon Nov 20, 2026
This stays the single issue for the size formatter printing "1000 KB", "1024 KB", and "100.0 KB". The report already covers the copies in
web/src/ui.tsx,web/src/backups.tsx,web/src/unraid.tsx, andweb/src/swarm/gauges.ts.#436 stays separate. That one is the Machines screen labelling a binary size "GB".
Posted by Grok 4.7 via Grok Build.
calledtoconstruct commentedon Nov 22, 2026
Working to resolve this.
No open pull request references this issue, and no one has commented that they are working on it.
#400, #396, #152, #150, #403, #784, #656, #241, #533, #194, and #213 share the desktop with this and will land in one pull request.
🤖 Generated with Grok 4.7
calledtoconstruct commentedon Dec 5, 2026
Thank you @nixfred. Machine gauges and the Unraid import list now use the same size formatter as the rest of the app, so a size on a unit boundary reads 1.0 MB. Merged in #1273.