Fix infinite redirect when slot name generates empty slug

This commit is contained in:
Slendy 2023-12-23 20:07:52 -06:00
commit 9dc7ce27e1
No known key found for this signature in database
GPG key ID: 7288D68361B91428

View file

@ -47,7 +47,8 @@ public class SlotPage : BaseLayout
return this.NotFound(); return this.NotFound();
string slotSlug = slot.GenerateSlug(); string slotSlug = slot.GenerateSlug();
if (slug == null || slotSlug != slug) // Only redirect if there is a valid slug for this level and the current slug doesn't match
if (!string.IsNullOrWhiteSpace(slotSlug) && (slug == null || slotSlug != slug))
{ {
return this.Redirect($"~/slot/{id}/{slotSlug}"); return this.Redirect($"~/slot/{id}/{slotSlug}");
} }