mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
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.
This commit is contained in:
parent
0d029f362d
commit
f32b2b2cc2
@ -193,7 +193,7 @@ namespace StarLight.Controllers
|
||||
html.Append("'>");
|
||||
|
||||
html.Append("<div class=\"videos__item-imgbox videos__movie-imgbox\"></div><div class=\"videos__item-title\">");
|
||||
Shared.Models.Templates.UtilsTpl.HtmlEncode(item.name, html);
|
||||
HtmlEncode(item.name, html);
|
||||
html.Append("</div></div>");
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user