Image sizes can read 1024 KB instead of 1.0 MB
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- electron, react, typescript
Research direction
Start with formatBytes in src/renderer/src/lib/format.ts and the existing tests in tests/format.test.ts. Add a describe('formatBytes') covering the listed boundary cases, a plain B value, and 1.5 KB; run pnpm test. Done means no output shows 1024 of a unit and values that round to 10 or more have no decimal.
Written by the indexing model from the issue text.
Description
formatBytes picks the unit before rounding, so a size just under the next unit rounds up to 1024 of the smaller one. Image cards and the inspector use it for file sizes.
| Bytes | Shows now | Should show |
|---|---|---|
1048575 |
1024 KB |
1.0 MB |
1073741823 |
1024 MB |
1.0 GB |
10239 |
10.0 KB |
10 KB |
10240 |
10 KB |
10 KB |
The last two rows are the same problem one digit down: values that round to 10 or more are meant to drop the decimal, but 9.999 passes the >= 10 check before it's rounded.
Where to look
src/renderer/src/lib/format.ts:formatBytestests/format.test.ts: already imports from@renderer/lib/format, so add adescribe('formatBytes')next to thehostOftests
#12 asks for broader tests of this file and to leave bugs for separate pull requests. This is that separate fix, so it's fine to do either one first.
Done when
- No size shows as 1024 of a unit, and anything that rounds to 10 or more has no decimal
- Tests cover the rows above plus a plain
Bvalue and a1.5 KBvalue, andpnpm testpasses
Suggested pull request title: fix(shelf): show 1.0 MB instead of 1024 KB
New to OpenPaste? CONTRIBUTING.md covers setup, the code conventions and the checks to run before a pull request (pnpm typecheck, pnpm test, pnpm format, pnpm cleaner). Leave a comment if you're picking this up so nobody doubles up.
Generated by Claude Code
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from alexsilver8/openpaste
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
alexsilver8/openpaste#31 ·
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
alexsilver8/openpaste#32 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
alexsilver8/openpaste#30 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
alexsilver8/openpaste#27 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
alexsilver8/openpaste#28 ·
All issues in alexsilver8/openpaste
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-dev-skill#151 ·
Maintainers usually reply within 1 day
-
area:arcade game ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fderuiter/deruiter.dev#2281 · 1 comment ·
Maintainers usually reply within 1 day
-
scope: data grid type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vicharanashala/ajrasakha#1439 ·
Maintainers usually reply within 1 day
-
Add: TV5Monde AsieOpenapproved check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day