diff --git a/DysonNetwork.Zone/Pages/Error.cshtml b/DysonNetwork.Zone/Pages/Error.cshtml index 0aa49e0..e2ef991 100644 --- a/DysonNetwork.Zone/Pages/Error.cshtml +++ b/DysonNetwork.Zone/Pages/Error.cshtml @@ -12,7 +12,7 @@

Something went wrong...

Powered by the Solar Network Pages

-

Path: @Model.CurrentPath

+

Path: @(Model.OriginalPath ?? Model.CurrentPath)

Site ID: @(Model.Site?.Id.ToString() ?? "none")

@if (Model.ShowRequestId) { diff --git a/DysonNetwork.Zone/Pages/Error.cshtml.cs b/DysonNetwork.Zone/Pages/Error.cshtml.cs index 5bab05b..9d988f8 100644 --- a/DysonNetwork.Zone/Pages/Error.cshtml.cs +++ b/DysonNetwork.Zone/Pages/Error.cshtml.cs @@ -3,6 +3,7 @@ using DysonNetwork.Shared.Models; using DysonNetwork.Zone.Publication; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Diagnostics; namespace DysonNetwork.Zone.Pages; @@ -19,6 +20,7 @@ public class ErrorModel : PageModel public SnPublicationSite? Site { get; set; } public string? SiteName { get; set; } public string? CurrentPath { get; set; } + public string? OriginalPath { get; set; } public void OnGet() { @@ -29,5 +31,8 @@ public class ErrorModel : PageModel SiteName = Request.Headers["X-SiteName"].ToString(); CurrentPath = Request.Path; + + var statusCodeReExecuteFeature = HttpContext.Features.Get(); + OriginalPath = statusCodeReExecuteFeature?.OriginalPath; } } \ No newline at end of file diff --git a/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs b/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs index 3892e3b..6d29065 100644 --- a/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs +++ b/DysonNetwork.Zone/Publication/PublicationSiteMiddleware.cs @@ -21,7 +21,7 @@ public class PublicationSiteMiddleware(RequestDelegate next) } var site = await db.PublicationSites - .FirstOrDefaultAsync(s => EF.Functions.ILike(s.Name, siteNameValue)); + .FirstOrDefaultAsync(s => EF.Functions.ILike(s.Slug, siteNameValue)); if (site == null) { await next(context); @@ -42,7 +42,7 @@ public class PublicationSiteMiddleware(RequestDelegate next) await context.Response.WriteAsync(content.ToString()); return; case PublicationPageType.Redirect - when page.Config.TryGetValue("url", out var url) && url is JsonElement redirectUrl: + when page.Config.TryGetValue("target", out var tgt) && tgt is JsonElement redirectUrl: context.Response.Redirect(redirectUrl.ToString()); return; }