Merge pull request #3137 from sbwalker/dev
fix #3134 improve parsing of headcontent to handle space delimiters
This commit is contained in:
commit
0aeb1a62b9
|
@ -96,7 +96,7 @@
|
|||
{
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await GetPackage(context.PackageId, context.Version))>@SharedLocalizer["Download"]</button>
|
||||
}
|
||||
@if (context.Price != null && !string.IsNullOrEmpty(context.PaymentUrl))
|
||||
@if (context.Price != null && !string.IsNullOrEmpty(context.PaymentUrl) && string.IsNullOrEmpty(context.PackageUrl))
|
||||
{
|
||||
<a class="btn btn-success ms-2" style="text-decoration: none !important" href="@context.PaymentUrl" target="_new">@SharedLocalizer["Buy"]</a>
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
{
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await GetPackage(context.PackageId, context.Version))>@SharedLocalizer["Download"]</button>
|
||||
}
|
||||
@if (context.Price != null && !string.IsNullOrEmpty(context.PaymentUrl))
|
||||
@if (context.Price != null && !string.IsNullOrEmpty(context.PaymentUrl) && string.IsNullOrEmpty(context.PackageUrl))
|
||||
{
|
||||
<a class="btn btn-success ms-2" style="text-decoration: none !important" href="@context.PaymentUrl" target="_new">@SharedLocalizer["Buy"]</a>
|
||||
}
|
||||
|
|
|
@ -67,16 +67,19 @@
|
|||
if (!string.IsNullOrEmpty(content))
|
||||
{
|
||||
// format head content, remove scripts, and filter duplicate elements
|
||||
var elements = (">" + content.Replace("\n", "") + "<").Split("><");
|
||||
foreach (var element in elements)
|
||||
content = content.Replace("\n", "");
|
||||
var index = content.IndexOf("<");
|
||||
while (index >= 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(element) && !element.ToLower().StartsWith("script"))
|
||||
var element = content.Substring(index, content.IndexOf(">", index) - index + 1);
|
||||
if (!string.IsNullOrEmpty(element) && !element.ToLower().StartsWith("<script"))
|
||||
{
|
||||
if (!headcontent.Contains("<" + element + ">"))
|
||||
if (!headcontent.Contains(element))
|
||||
{
|
||||
headcontent += "<" + element + ">" + "\n";
|
||||
headcontent += element + "\n";
|
||||
}
|
||||
}
|
||||
index = content.IndexOf("<", index + 1);
|
||||
}
|
||||
}
|
||||
return headcontent;
|
||||
|
|
Loading…
Reference in New Issue
Block a user