From 995e80cb77e4143f1798c7bb47182a4dd0dbaac7 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 8 Sep 2022 16:13:24 +0100 Subject: [PATCH] 404 legacy links --- VoidCat/Controllers/IndexController.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/VoidCat/Controllers/IndexController.cs b/VoidCat/Controllers/IndexController.cs index c866924..917daa5 100644 --- a/VoidCat/Controllers/IndexController.cs +++ b/VoidCat/Controllers/IndexController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Mvc; +using System.Text.RegularExpressions; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using VoidCat.Model; using VoidCat.Services.Abstractions; @@ -30,6 +31,12 @@ public class IndexController : Controller var manifestPath = Path.Combine(_webHost.WebRootPath, "asset-manifest.json"); if (!System.IO.File.Exists(manifestPath)) return StatusCode(500); + // old format hash, return 404 + if (id.Length == 40 && Regex.IsMatch(id, @"[0-9a-z]{40}")) + { + Response.StatusCode = 404; + } + var jsonManifest = await System.IO.File.ReadAllTextAsync(manifestPath); return View("~/Pages/Index.cshtml", new IndexModel {