Skip to content

[eas-shared] Fix formatBytes returning wrong values for sizes >= 102.4 GB - #363

Merged
gabrieldonadel merged 2 commits into
expo:mainfrom
YuriNachos:YuriNachos/w7-orbit
Aug 9, 2026
Merged

[eas-shared] Fix formatBytes returning wrong values for sizes >= 102.4 GB#363
gabrieldonadel merged 2 commits into
expo:mainfrom
YuriNachos:YuriNachos/w7-orbit

Conversation

@YuriNachos

Copy link
Copy Markdown
Contributor

Summary

formatBytes returned wrong values for sizes ≥ 102.4 GB. The final GB fallback divided by the literal 1024 instead of multiplier (which is 1024**3 in that branch), so formatBytes(200 GB) returned "209715200 GB" instead of "200 GB". Every other tier correctly divides by multiplier; only the GB fallback was wrong.

Fix

One expression: bytes / 1024bytes / multiplier, mirroring the MB fallback on the line above verbatim.

Test

New files.test.ts with 8 cases spanning B / KB / MB / GB (incl. the 200 GB bug reproducer and a 1024 GB boundary). yarn test (eas-shared) — 20 passed, 0 failed.


Authored by @YuriNachos. Implementation written by a cccc (Claude Code, GLM-5.2) worker under orchestrator acceptance — gate green (20 passed).

The final GB fallback tier divided by a literal 1024 instead of by the
accumulated multiplier (1024**3), so the result was short by 1024**2.
formatBytes(200 * 1024**3) returned "209715200 GB" instead of "200 GB".
Divide by multiplier, mirroring the MB fallback one tier up. Adds a
table-driven jest regression test covering every tier.

Co-Authored-By: Claude <noreply@anthropic.com>

@gabrieldonadel gabrieldonadel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution

Comment thread CHANGELOG.md Outdated
@gabrieldonadel
gabrieldonadel merged commit caacff5 into expo:main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants