Skip to content

fix: find usernames in any case, like GitHub - #531

Open
Akiyo974 wants to merge 3 commits into
dev-null-sh:productionfrom
Akiyo974:fix/username-case
Open

Akiyo974 wants to merge 3 commits into
dev-null-sh:productionfrom
Akiyo974:fix/username-case

Conversation

@Akiyo974

Copy link
Copy Markdown
Contributor

GitHub usernames are case-insensitive (github.com/nunomaduro and github.com/NunoMaduro are the same profile), but /dev/null looked them up exactly. A profile link typed or shared in another case was a 404, on every {user:username} route:

User::resolveRouteBindingQuery() now matches username on LOWER(username), which the existing users_lower_username_index covers, so every route bound by username accepts any case. Usernames are already treated as unique case-insensitively (UpdateStaleUsernames, mentions), so at most one user can match. Other route keys are unchanged.

Tests: a profile and a commit page, and the public API, found in other cases. Both fail without the fix.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 01:58

Copilot AI 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.

🟢 Approval recommended

The change is narrowly scoped, preserves other bindings, and includes targeted regression coverage with no unresolved findings.

No open issues 🎉

What changed in this PR

Makes username-bound routes case-insensitive, matching GitHub’s behavior and preventing case-related 404s.

Changes:

  • Adds case-insensitive username binding while preserving other route keys.
  • Adds regression coverage for profile, commit, and public API requests.
File Description
tests/​Feature/​Controllers/​UserControllerTest.php Tests profile and commit access with alternate username casing.
tests/​Feature/​Controllers/​Api/​UserControllerTest.php Tests case-insensitive public API lookup.
app/​Models/​User.php Overrides username route binding with a lowercase comparison.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 19, 2026 04:59

Copilot AI 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.

🟢 Approval recommended

The focused change preserves other bindings, includes relevant regression coverage, and has no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@jubianchi

Copy link
Copy Markdown
Contributor

Hi @Akiyo974, thanks for this one. I think production now finds handles in any case, through #1286 (Oct 29) and #1338 (Oct 31), on top of the move of handles to profiles in #1156:

  • User::resolveRouteBindingQuery() resolves {user:handle} through Profile, and profiles.handle is now citext
  • https://dev-null.sh/@NunoMaduro answers a 301 to /@nunomaduro, and /api/v1/users/NunoMaduro answers 200
  • tests cover it in tests/Unit/Models/ProfileTest.php and in the UserControllerTest / CommitControllerTest "in its own case" cases

The users.username column this PR matches on was dropped in #1156. As far as I can tell, what this PR fixes is covered there.

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.

4 participants