Repository navigation
Conversation
Uploads a 1,048,100-byte theme file and reads the oversized notice. The dialog's own formatter picks KB before rounding, so the notice says "1024 KB" here and the test fails.
… KB" The theme import dialog formatted the size in its "That file is ..." notice with its own helper, which picked KB before rounding. A file from 1,048,064 to 1,048,575 bytes rounded to 1024 and read "1024 KB". That is the defect pingdotgg#26067 fixed in the shared formatBytes, and pingdotgg#28300 and pingdotgg#29165 removed from the Diagnostics and attachment sizes. The dialog now uses formatBytes from lib, so it picks the unit after rounding like the rest of the app. The 256 KB limit still reads "256 KB". Bug: theme import says a file just under 1 MB is "1024 KB"
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Theme-import errors now use the shared byte formatter to avoid displaying a rounded size as “1024 KB.” This is a presentation-only change; file-size limits and import behavior remain unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Much needed! |
|
Note Written by Verified in a real dev environmentverified unchanged head
before, main: after, PR head: file rejection, paste rejection, limit rejection, and recovery to a valid import: Not verifiednative Electron file picking, macOS/Windows, and native iOS/Android clients were not exercised on this Linux VM. Open VSX downloads, drag-and-drop, batch imports, and other providers were outside this focused pass. the changed formatter is in the web dialog; the native desktop bridge itself is unchanged. |




Problem
Settings > Appearance > Import theme refuses a theme file over 256 KB with a notice that gives its size. A file from 1,048,064 to 1,048,575 bytes reads "That file is 1024 KB" when it should read "1.00 MB".
The dialog formats that size with its own
formatByteSize, which picks KB before rounding, soMath.round(bytes / 1024)reaches 1024 while the unit is still KB.Change
ThemeImportDialogdropsformatByteSizeand uses the sharedapps/web/src/lib/formatBytes, which picks the unit after rounding. The notice for an oversized paste goes through the same function and changes the same way.Beyond the boundary fix, sizes now read the way every other size in the app does:
The limit in the same sentence still reads "256 KB".
Scope and approval
This is a small, focused fix for an obvious bug, so it needs no prior issue. #26067 fixed this rounding in the shared
formatBytes, and #29165 fixed it in attachment sizes. #28300 fixed it in Diagnostics by replacing that view's private formatter withformatBytes, and its description names this dialog as the follow-up: "Other private copies with the same rounding bug stay out of this PR, one problem each: the theme import size inThemeImportDialog.tsxand mobile's Client Storage settings." This PR is that follow-up for the web copy, done the same way. Mobile's copy is #28648.Verification
apps/web/src/components/settings/ThemeImportDialog.browser.test.tsxgets one case. It uploads a 1,048,100-byte theme file and checks the notice. It sits at the dialog because that is the lowest layer that fails onmain: the sharedformatBytesalready passes this size, and the broken helper was private to the dialog.On
mainwith only the test commit (21aac83), fromapps/web,vp test run src/components/settings/ThemeImportDialog.browser.test.tsx:With the fix, from
apps/web:vp test run src/components/settings/ThemeImportDialog.browser.test.tsx src/lib/formatBytes.test.ts: 2 files, 18 tests passed.vp run check:changedfrom the repo root: format, lint, knip, typecheck, tests beside the change and the React Compiler check all pass.In a running dev build (Windows,
vp run dev), Settings > Appearance > Add theme, choosing a 1,048,100-byte.jsonfile:main)Bug: theme import says a file just under 1 MB is "1024 KB"
This was written with Claude Opus 5.5 in Claude Code, driven from T3 Code.