fix #3235 - </script> not being removed from Head Content
This commit is contained in:
parent
037f1ec887
commit
26921c899e
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -437,17 +437,17 @@ namespace Oqtane.Pages
|
|||
"</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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user