Skip to content

Commit 9348d58

Browse files
committed
Fix infinite redirect for users with empty usernames
1 parent 67d0d3d commit 9348d58

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public async Task<IActionResult> OnGet([FromRoute] int userId, string? slug)
4545
if (this.ProfileUser == null) return this.NotFound();
4646

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

0 commit comments

Comments
 (0)