Upstream zzzprojects/html-agility-pack state of the touched files before cda2ad348b

This commit is contained in:
upstream committed 2026-09-04 09:42:55 +02:00
1 parent 56dba32abf
commit c0a3e1d33a
2 files changed
+1 -27

No files matched your search

+1 -2
View File
@@ -663,8 +663,7 @@ namespace HtmlAgilityPack
}
catch
{
// 'e' already starts with '#', so prepending "&#" would duplicate it.
sb.Append("&" + e + ";");
sb.Append("&#" + e + ";");
}
}
else
@@ -1,25 +0,0 @@
using Xunit;
namespace HtmlAgilityPack.Tests.NetStandard2_0
{
public class HtmlEntityDeEntitizeTests
{
[Theory]
// Invalid numeric entities must be left untouched; "&#foo;" used to become
// "&##foo;".
[InlineData("&#foo;", "&#foo;")]
[InlineData("&#xGG;", "&#xGG;")]
[InlineData("&#;", "&#;")]
[InlineData("prefix &#foo; suffix", "prefix &#foo; suffix")]
// Valid numeric entities keep decoding correctly.
[InlineData("A", "A")]
[InlineData("A", "A")]
// Named entities are unaffected.
[InlineData("&", "&")]
[InlineData("&notreal;", "&notreal;")]
public void DeEntitize_HandlesInvalidNumericEntitiesWithoutDuplicatingHash(string input, string expected)
{
Assert.Equal(expected, HtmlEntity.DeEntitize(input));
}
}
}