From f32b2b2cc2df11f0daf783f30c83f1fbec07cdf2 Mon Sep 17 00:00:00 2001 From: baliasnyifeliks Date: Wed, 14 Jan 2026 09:42:48 +0200 Subject: [PATCH] refactor(starlight): replace external HtmlEncode with local implementation The Controller.cs file now uses a local HtmlEncode method instead of the external Shared.Models.Templates.UtilsTpl.HtmlEncode utility. This change improves encapsulation and reduces external dependencies while maintaining the same HTML encoding functionality for special characters. --- StarLight/Controller.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/StarLight/Controller.cs b/StarLight/Controller.cs index 58ee1cd..efa9acf 100644 --- a/StarLight/Controller.cs +++ b/StarLight/Controller.cs @@ -193,7 +193,7 @@ namespace StarLight.Controllers html.Append("'>"); html.Append("
"); - Shared.Models.Templates.UtilsTpl.HtmlEncode(item.name, html); + HtmlEncode(item.name, html); html.Append("
"); firstjson = false; @@ -203,5 +203,24 @@ namespace StarLight.Controllers return html.ToString(); } + + private static void HtmlEncode(string value, StringBuilder sb) + { + if (string.IsNullOrEmpty(value)) + return; + + foreach (var c in value) + { + switch (c) + { + case '<': sb.Append("<"); break; + case '>': sb.Append(">"); break; + case '&': sb.Append("&"); break; + case '"': sb.Append("""); break; + case '\'': sb.Append("'"); break; + default: sb.Append(c); break; + } + } + } } }