Repository navigation
fix(web): show 1.0 MB instead of 1024.0 KB at file size unit boundaries - #6560
SwastikTripathi wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Suggested reviewers: Merge Risk:
|
The resource stats section had its own copy of the size formatter with the same unit boundary bug (1048575 bytes showed as 1024.0 KB).
|
Added 673c03a: the admin resource stats section had its own copy of the size formatter ( |
formatFileSizepicks the unit before rounding, so a size just under the next unit rounds up to 1024 of the smaller one:It's used for attachment metadata, the storage line in account settings and the byte-based usage limits.
The function now moves to the next unit when the rounded value reaches 1024, adds
PB, and clamps the unit index to the list.Added
web/tests/format.test.ts: the boundary and PB cases fail before the change. All 200 web test files pass,tsc --noEmit --skipLibCheckis clean and biome is clean on the changed files.