From 59e42ff7cd6fad233c0ec4dab6c80ce6691707d1 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 15 Jul 2024 19:44:02 +0100 Subject: [PATCH] perf: use http utility to decode url --- OliverBooth/Pages/Blog/Index.cshtml.cs | 3 ++- OliverBooth/Pages/Blog/List.cshtml.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OliverBooth/Pages/Blog/Index.cshtml.cs b/OliverBooth/Pages/Blog/Index.cshtml.cs index f825701..87f8497 100644 --- a/OliverBooth/Pages/Blog/Index.cshtml.cs +++ b/OliverBooth/Pages/Blog/Index.cshtml.cs @@ -1,3 +1,4 @@ +using System.Web; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using OliverBooth.Common.Data.Blog; @@ -23,7 +24,7 @@ public class Index : PageModel { if (postId.HasValue == wpPostId.HasValue) { - Tag = tag?.Split('+').Select(t => t.Replace("%20", " ")).ToArray() ?? []; + Tag = (tag?.Split('+').Select(HttpUtility.UrlDecode).ToArray() ?? [])!; return Page(); } diff --git a/OliverBooth/Pages/Blog/List.cshtml.cs b/OliverBooth/Pages/Blog/List.cshtml.cs index 4660b20..51b3a2a 100644 --- a/OliverBooth/Pages/Blog/List.cshtml.cs +++ b/OliverBooth/Pages/Blog/List.cshtml.cs @@ -1,3 +1,4 @@ +using System.Web; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; @@ -30,7 +31,7 @@ public class List : PageModel } PageNumber = page; - Tag = tag?.Split('+').Select(t => t.Replace("%20", " ")).ToArray() ?? []; + Tag = (tag?.Split('+').Select(HttpUtility.UrlDecode).ToArray() ?? [])!; return Page(); } }