Skip to content

Commit

Permalink
Fix infinite redirect for users with empty usernames
Browse files Browse the repository at this point in the history
  • Loading branch information
Slendy committed Apr 15, 2024
1 parent 67d0d3d commit 9348d58
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public async Task<IActionResult> OnGet([FromRoute] int userId, string? slug)
if (this.ProfileUser == null) return this.NotFound();

string userSlug = this.ProfileUser.GenerateSlug();
if (slug == null || userSlug != slug)
// Only redirect if there is a valid slug for this user and the current slug doesn't match
if (!string.IsNullOrWhiteSpace(userSlug) && (slug == null || userSlug != slug))
{
return this.Redirect($"~/user/{userId}/{userSlug}");
}
Expand Down

0 comments on commit 9348d58

Please sign in to comment.