Skip to content

fix: trim whitespace from parcel name/description and reject blank-only description#224

Merged
Jakubk15 merged 2 commits into
masterfrom
fix/issue-219-220-trim-name-description
Jun 22, 2026
Merged

fix: trim whitespace from parcel name/description and reject blank-only description#224
Jakubk15 merged 2 commits into
masterfrom
fix/issue-219-220-trim-name-description

Conversation

@Jakubk15

Copy link
Copy Markdown
Member

Summary

Changes

Both fixes are in SendingGui.java inside the Paper Dialog response callbacks:

  • Name: call .trim() on the raw input before passing it to state.parcelName()
  • Description: trim the raw input; if the result is blank, store null instead of the whitespace string

Test plan

  • Enter a parcel name with leading/trailing spaces (e.g. My Parcel ) — verify it is stored and displayed as My Parcel
  • Enter a parcel description with leading/trailing spaces — verify it is trimmed
  • Enter a description consisting only of spaces — verify it is treated as unset (description item shows the default "not set" appearance)
  • Normal flow: name, description, receiver, destination all set correctly — verify parcel sends successfully

🤖 Generated with Claude Code

https://claude.ai/code/session_01R4YqhTV42FvN95HanC7XJc

…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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +158 to +160
String trimmedDescription = description != null ? description.trim() : null;

this.state.parcelDescription(description);
this.state.parcelDescription(trimmedDescription == null || trimmedDescription.isEmpty() ? null : trimmedDescription);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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);

@Jakubk15 Jakubk15 merged commit 47a6702 into master Jun 22, 2026
1 check passed
@Jakubk15 Jakubk15 deleted the fix/issue-219-220-trim-name-description branch June 22, 2026 17:23
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.

It is possible to create a parcel with description consisting of only spaces Spaces before text in parcel name/description are not being trimmed

1 participant