From 064fe6c291218934d3a3517acc707226d64d155a Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 21 Oct 2024 08:01:32 +1000 Subject: [PATCH] Fix missing images everywhere when running locally --- TASVideos/Pages/Wiki/Render.cshtml.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/TASVideos/Pages/Wiki/Render.cshtml.cs b/TASVideos/Pages/Wiki/Render.cshtml.cs index 26e3e8cda..ecf7826db 100644 --- a/TASVideos/Pages/Wiki/Render.cshtml.cs +++ b/TASVideos/Pages/Wiki/Render.cshtml.cs @@ -4,7 +4,12 @@ namespace TASVideos.Pages.Wiki; [AllowAnonymous] -public class RenderModel(IWikiPages wikiPages, ApplicationDbContext db, ILogger logger) : BasePageModel +public class RenderModel( + IWikiPages wikiPages, + ApplicationDbContext db, + IHostEnvironment env, + ILogger logger +) : BasePageModel { public IWikiPage WikiPage { get; set; } = null!; @@ -32,6 +37,12 @@ public async Task OnGet(string? url, int? revision = null) return Redirect(LinkConstants.HomePages + url); } + if (env.IsDevelopment() && url.StartsWith("media/")) + { + // fix missing images everywhere when running locally + return Redirect("/images/tasvideos_rss.png"); + } + return RedirectToPage("/Wiki/PageNotFound", new { possibleUrl = WikiEngine.Builtins.NormalizeInternalLink(url) }); }