fix: trim whitespace from parcel name/description and reject blank-only description#224
Conversation
…ut (#219, #220) - Trim parcel name before storing to strip leading/trailing spaces - Trim parcel description and coerce a whitespace-only entry to null (treated as unset) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc
There was a problem hiding this comment.
Code Review
This pull request introduces input trimming for parcel names and descriptions in SendingGui.java to prevent leading or trailing whitespace. A review comment suggests simplifying the parcel description handling logic by using String#isBlank() to check for null or whitespace-only strings, which would make the code cleaner and more concise.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| String trimmedDescription = description != null ? description.trim() : null; | ||
|
|
||
| this.state.parcelDescription(description); | ||
| this.state.parcelDescription(trimmedDescription == null || trimmedDescription.isEmpty() ? null : trimmedDescription); |
There was a problem hiding this comment.
This logic can be simplified by leveraging String#isBlank() (which is already used in this class) to check if the description is null or whitespace-only, and then directly assigning the trimmed value or null.
| String trimmedDescription = description != null ? description.trim() : null; | |
| this.state.parcelDescription(description); | |
| this.state.parcelDescription(trimmedDescription == null || trimmedDescription.isEmpty() ? null : trimmedDescription); | |
| String trimmedDescription = (description == null || description.isBlank()) ? null : description.trim(); | |
| this.state.parcelDescription(trimmedDescription); |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc
Summary
null(treated as unset) rather than saved as a whitespace-only stringChanges
Both fixes are in
SendingGui.javainside the Paper Dialog response callbacks:.trim()on the raw input before passing it tostate.parcelName()nullinstead of the whitespace stringTest plan
My Parcel) — verify it is stored and displayed asMy Parcel🤖 Generated with Claude Code
https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc