perf: use http utility to decode url

This commit is contained in:
Oliver Booth 2024-07-15 19:44:02 +01:00
parent d32d46e221
commit 59e42ff7cd
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
2 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,4 @@
using System.Web;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
using OliverBooth.Common.Data.Blog; using OliverBooth.Common.Data.Blog;
@ -23,7 +24,7 @@ public class Index : PageModel
{ {
if (postId.HasValue == wpPostId.HasValue) if (postId.HasValue == wpPostId.HasValue)
{ {
Tag = tag?.Split('+').Select(t => t.Replace("%20", " ")).ToArray() ?? []; Tag = (tag?.Split('+').Select(HttpUtility.UrlDecode).ToArray() ?? [])!;
return Page(); return Page();
} }

View File

@ -1,3 +1,4 @@
using System.Web;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
@ -30,7 +31,7 @@ public class List : PageModel
} }
PageNumber = page; PageNumber = page;
Tag = tag?.Split('+').Select(t => t.Replace("%20", " ")).ToArray() ?? []; Tag = (tag?.Split('+').Select(HttpUtility.UrlDecode).ToArray() ?? [])!;
return Page(); return Page();
} }
} }