Fix infinite redirect for users with empty usernames

This commit is contained in:
Slendy 2024-04-15 14:11:47 -05:00
parent 67d0d3d7b1
commit 9348d58158
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -45,7 +45,8 @@ public class UserPage : BaseLayout
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}");
}