Skip to content

Commit

Permalink
Merge pull request #3239 from sbwalker/dev
Browse files Browse the repository at this point in the history
fix #3235 - </script> not being removed from Head Content
  • Loading branch information
sbwalker authored Sep 8, 2023
2 parents a1e5912 + 26921c8 commit c0991df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Oqtane.Client/UI/ThemeBuilder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
while (index >= 0)
{
var element = content.Substring(index, content.IndexOf(">", index) - index + 1);
if (!string.IsNullOrEmpty(element) && !element.ToLower().StartsWith("<script"))
if (!string.IsNullOrEmpty(element) && !element.ToLower().StartsWith("<script") && !element.ToLower().StartsWith("</script"))
{
if (!headcontent.Contains(element))
{
Expand Down
10 changes: 5 additions & 5 deletions Oqtane.Server/Pages/_Host.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,17 @@ private string CreateReconnectScript()
"</script>";
}

private string ParseScripts(string headcontent)
private string ParseScripts(string content)
{
// iterate scripts
var scripts = "";
if (!string.IsNullOrEmpty(headcontent))
if (!string.IsNullOrEmpty(content))
{
var index = headcontent.IndexOf("<script");
var index = content.IndexOf("<script");
while (index >= 0)
{
scripts += headcontent.Substring(index, headcontent.IndexOf("</script>", index) + 9 - index);
index = headcontent.IndexOf("<script", index + 1);
scripts += content.Substring(index, content.IndexOf("</script>", index) + 9 - index);
index = content.IndexOf("<script", index + 1);
}
}
return scripts;
Expand Down

0 comments on commit c0991df

Please sign in to comment.