Skip to content

Commit

Permalink
Merge pull request #3847 from sbwalker/dev
Browse files Browse the repository at this point in the history
in static render mode do not filter scripts from head content
  • Loading branch information
sbwalker authored Feb 19, 2024
2 parents 29aff29 + 4db3baf commit 8107177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions Oqtane.Client/UI/Head.razor
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@

private string RemoveScripts(string headcontent)
{
if (!string.IsNullOrEmpty(headcontent))
{
var index = headcontent.IndexOf("<script");
while (index >= 0)
{
headcontent = headcontent.Remove(index, headcontent.IndexOf("</script>") + 9 - index);
index = headcontent.IndexOf("<script");
}
}
// if (!string.IsNullOrEmpty(headcontent))
// {
// var index = headcontent.IndexOf("<script");
// while (index >= 0)
// {
// headcontent = headcontent.Remove(index, headcontent.IndexOf("</script>") + 9 - index);
// index = headcontent.IndexOf("<script");
// }
// }
return headcontent;
}

Expand Down
2 changes: 1 addition & 1 deletion Oqtane.Client/UI/ThemeBuilder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
while (index >= 0)
{
var element = content.Substring(index, content.IndexOf(">", index) - index + 1);
if (!string.IsNullOrEmpty(element) && !element.ToLower().StartsWith("<script") && !element.ToLower().StartsWith("</script"))
if (!string.IsNullOrEmpty(element) && (PageState.RenderMode == RenderModes.Static || (!element.ToLower().StartsWith("<script") && !element.ToLower().StartsWith("</script"))))
{
if (!headcontent.Contains(element))
{
Expand Down

0 comments on commit 8107177

Please sign in to comment.