-
Notifications
You must be signed in to change notification settings - Fork 153
fix: last name with space issue #1106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughUpdates URL construction in the APIs constants file to properly encode query parameters using Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5–10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/constants/apis.js (1)
21-26: Good fix: query params are now correctly URL-encoded (prevents spaces/special chars breaking the request).
This aligns with the PR objective; encodingfirstname/lastnamein the query string is the right move.Hardening suggestion: consider guarding nullish/non-string inputs to avoid accidental
"undefined"/"null"being sent if upstream sanitization regresses.export const GENERATE_USERNAME_URL = ( sanitizedFirstname, sanitizedLastname, ) => { - return `${APPS.API_BACKEND}/users/username?dev=true&firstname=${encodeURIComponent(sanitizedFirstname)}&lastname=${encodeURIComponent(sanitizedLastname)}`; + const firstname = encodeURIComponent(String(sanitizedFirstname ?? '')); + const lastname = encodeURIComponent(String(sanitizedLastname ?? '')); + return `${APPS.API_BACKEND}/users/username?dev=true&firstname=${firstname}&lastname=${lastname}`; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
app/constants/apis.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/constants/apis.js (1)
app/constants/urls.js (2)
APPS(65-65)APPS(65-65)
| export const CHECK_USERNAME_AVAILABILITY = (userName) => { | ||
| return `${APPS.API_BACKEND}/users/isUsernameAvailable/${userName}`; | ||
| return `${APPS.API_BACKEND}/users/isUsernameAvailable/${encodeURIComponent(userName)}`; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Path-segment encoding is correct, but verify backend decoding + routing expectations.
encodeURIComponent(userName) will encode / as %2F (treating username as opaque), which is typically desirable, but please confirm the backend route /users/isUsernameAvailable/:userName (and any proxies) reliably decode this and don’t expect raw slashes.
Optional: if you want to avoid path-segment edge cases entirely, consider switching this endpoint to a query param (.../isUsernameAvailable?userName=...) if the backend supports it.
Date:
12/12/2025Developer Name:
Mohammad Rehan KhanIssue Ticket Number:-
#1105Description:
✅ LastName with spaces (e.g., "A M") now works correctly
✅ FirstName with spaces also handled properly
✅ Special characters in names are properly encoded
✅ Username generation API calls succeed with properly formatted URLs
✅ Username availability checks handle special characters correctly
The fix ensures that any special characters (spaces, apostrophes, accented characters, etc.) in names are properly URL-encoded, preventing malformed API requests and allowing the signup flow to complete successfully.
Is Under Feature Flag
Database changes
Breaking changes (If your feature is breaking/missing something please mention pending tickets)
Is Development Tested?
Tested in staging?