Repository navigation
fix(ui): move attachment sizes to MB when rounding reaches 1024 KB - #3643
Merged
Charlesthebird merged 1 commit intoNov 11, 2026
Merged
Conversation
Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
timflannagan
approved these changes
Nov 11, 2026
timflannagan
left a comment
Contributor
There was a problem hiding this comment.
Seems reasonable to me. Just triggered CI, we'll see where that lands. FYI @Charlesthebird since it touches the UI in case you wanted to sanity check too
Charlesthebird
left a comment
Collaborator
There was a problem hiding this comment.
This automated review is a first pass. A manual review will follow once the blockers are addressed.
No blockers. The unit is now chosen after rounding, so values that round to 1024 KB read as MB.
✅ What I checked
- ✅
1048524 / 1024 = 1023.949, which rounds to1023.9, so it stays in KB. - ✅
1048525 / 1024 = 1023.950, which rounds to1024, so it moves to MB.1048525 / 1048576rounds to1.0, printed as1 MB. - ✅ Inputs of 1024 bytes and up, 1048576, and 5 MiB take the same branches as before.
- ✅
formatByteshas the same signature, and the new cases sit in the existing test file. - ✅ The diff has no internal brand terms.
Written by 🤖
Collaborator
Charlesthebird
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
formatBytesinui/src/api/chat/attachments.ts(used by the attachment chip and the "would put this message over ..." staging error) chooses KB or MB from the raw byte count and only then rounds to one decimal. A file just under 1 MiB therefore shows as1024 KB:The KB value is now rounded first, and the function moves to MB when that rounded value reaches 1024. Everything else prints exactly as before (
1048524is still1023.9 KB, and whole MiB values are unchanged).Testing
formatBytestable toattachments.test.tscovering the B/KB and KB/MB boundaries. The1048525and1048575cases fail onmainand pass with this change; the rest of the file (62 tests) passes withvitest run src/api/chat/attachments.test.ts.This PR was prepared with AI assistance; I reviewed the change and ran the tests above.