Skip to content

Commit

Permalink
Fix missing images everywhere when running locally
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Oct 20, 2024
1 parent d72b31b commit 064fe6c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion TASVideos/Pages/Wiki/Render.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
namespace TASVideos.Pages.Wiki;

[AllowAnonymous]
public class RenderModel(IWikiPages wikiPages, ApplicationDbContext db, ILogger<RenderModel> logger) : BasePageModel
public class RenderModel(
IWikiPages wikiPages,
ApplicationDbContext db,
IHostEnvironment env,
ILogger<RenderModel> logger
) : BasePageModel
{
public IWikiPage WikiPage { get; set; } = null!;

Expand Down Expand Up @@ -32,6 +37,12 @@ public async Task<IActionResult> 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) });
}

Expand Down

0 comments on commit 064fe6c

Please sign in to comment.