Resolve profile handles case-insensitively in /u/ URLs - #29
Merged
Merged
Conversation
Handles are stored lowercase (profiles_handle_format requires handle = lower(handle), and the auth trigger lowercases the GitHub login), but the profile page matched the URL param with exact string equality. Every internal link uses the stored lowercase handle, so only a URL typed or shared with GitHub's casing breaks — and it breaks with a bare 'No such user.' for an account that exists. Lowercase the route param before querying and redirect mixed-case URLs to the canonical lowercase path, preserving the tab query. No adapter change needed: the /u/:handle param is the only user-supplied handle in the API surface. Repro on production: /u/SergiioB 404s while /u/sergiiob renders.
|
@SergiioB is attempting to deploy a commit to the Community Labs Team on Vercel. A member of the Team first needs to authorize it. |
No result files to import. |
toAppUser built the session user's handle from GitHub auth metadata (user_name), which keeps GitHub's original casing, while the auth trigger stores profile handles lowercase (handle = lower(handle)). Handles are compared with exact string equality everywhere, so the mismatch broke two things for anyone whose GitHub login has capitals: - TopNav "My rigs"/"My results" linked to /u/SergiioB, which the profile page 404s (the first report of this bug). - The submit form filtered rigs with owner = session handle, matched nothing, showed "You have no rigs yet. Create the first one." and auto-opened the rig creator — inviting duplicate rigs on every visit. Lowercase the handle in toAppUser, mirroring the trigger's lower(coalesce(user_name, preferred_username, email prefix, id)). api.me() already returned the stored profile handle; the session user now agrees with it.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Collaborator
|
Thanks Sergio. After some research, it looks like this should resolve some of the issues, including people who can't submit rigs (like this commenter here). It looks like there were some issues with some extra columns added to the database having different permissions, preventing the result for being submitted. This should be resolved now! |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Profile URLs are case-sensitive even though handles are always stored lowercase:
profiles_handle_formatrequireshandle = lower(handle), and the auth sync trigger lowercases the GitHub login before upsert./u/:handleroute param with exact string equality, so a URL typed or shared with GitHub's casing returned "Not found — No such user." for an account that exists.Live repro on production: https://www.intelinside.ai/u/SergiioB 404s, while https://www.intelinside.ai/u/sergiiob renders. Every internal link is unaffected because it uses the stored lowercase handle — this only bites users who type or share their profile URL the way GitHub displays it.
Fix
In
Profile.tsx, lowercase the route param before it feeds the user/rigs/results/custom-runtimes queries, and redirect mixed-case URLs to the canonical lowercase path (preserving the?tab=query) so the address bar converges on the shareable form.No adapter changes needed: the
/u/:handleparam is the only user-supplied handle in the API surface — every other caller passes handles from the session or the catalog, already lowercase.Verification
npm run typecheckandnpm run buildpass.