Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 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
…case # Conflicts: # app/Models/User.php
Contributor
|
Hi @Akiyo974, thanks for this one. I think
The |
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.
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:/commits/{commit},/followers,/following,/feed.atom,/og.png…User::resolveRouteBindingQuery()now matchesusernameonLOWER(username), which the existingusers_lower_username_indexcovers, 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.